Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to replace and concatenate Flex strings

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to replace and connect Flex strings, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Flex string processing

1. Connect Flex string

Concatenating Flex strings means that two or more Flex strings are merged into a single Flex string.

1.1.The "+" operator concatenates Flex strings

Format: Flex string 1+Flex string 2 characters...

/ / the result is "Thisworks"

Varexample:String= "This" + "works"; / / result is "Thereare24people" varattendance:int=24; varoutput:String= "Thereare" + attendance+ "people"; / /

Here the compiler automatically converts attendance to Flex strings.

But with numeric types on both sides of the + sign, the type needs to be cast before it can be added.

1.2.The "+ =" operator concatenates the Flex string:

Represents an advanced concatenation operation and then assigns the result to * Flex strings.

Format: Flex string + = Flex string 2+Flex string 3 times...

Vars1:String= "11"; trace (S1 = "22" + "33"); / / display "112233"

two。 Replace Flex string

Replace the Flex string function replace:

Searches for the specified Flex string and replaces it with another Flex string, and then returns the replaced Flex string. This method can only replace * matching Flex strings. To replace them all, you need to use a loop.

Format: Flex string variable .replace (search Flex string, replace Flex string)

2.2 other replacement functions split+join

Format: Flex string variable .split (delimited Flex string)

Array variable .join (concatenate Flex string)

Varexample:String= "Thisis

Asentence

On3lines "; / * is displayed as: Thisis asentence on3lines * / trace (example.split ("

Thank you for reading this article carefully. I hope the article "how to replace and concatenate Flex strings" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report