-
1. Re: Format string when get from database
Aaron Beall Dec 12, 2013 9:06 AM (in response to ndt.company)Try changing s:Label/maxDisplayedLines or using mx:Text
-Aaron
-
2. Re: Format string when get from database
ndt.company Dec 12, 2013 6:23 PM (in response to Aaron Beall)@Aaron: thanks for your response, but I tried using maxDisplayedLines and mx:Text, richText ... but it still not working
-
3. Re: Format string when get from database
coolik Dec 12, 2013 9:05 PM (in response to ndt.company)Hi,
if you have inserted this text in the database as is: "Here is the first sentence. \n And here is the second sentence" you will get exactly the same text in Flex- there is nothing surprising here. Did you try inserting "Here is the first sentence.
And here is the second sentence" ?
If this will not work try: "Here is the first sentence." + CHAR(13) + CHAR(10) + "And here is the second sentence".
-
4. Re: Format string when get from database
Flex harUIDec 13, 2013 9:54 AM (in response to ndt.company)
It would be unusual for a string to have two characters '\' and 'n' to represent new lines when stored in databases or files. The '\n' is usually converted beforehand by compilers or interpreters into the correct characters. You might want to investigate how that is happening and change before it gets stored.
But if you can't change it before it is stored, I believe you can use the following to convert it
var fixedString:String = string.replace(/\\n/g, "\n");