Source language: Translate to:

List to single line

General questions about NeoBook

Moderator: Neosoft Support

List to single line

Postby stu » Wed Mar 11, 2015 6:32 am

Hello,

I been trying to convert a list to a single line, sort of like:

1
2
3

to

123

So far I tried StrReplace trying to replace Line Feed ([#10]) with Delete and all sorts but the list keeps the same.
Btw, list comes from a simple multiline textbox.

Any ideas on how to accomplish this?

Regards.
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: List to single line

Postby Gaev » Wed Mar 11, 2015 7:02 am

stu:

It is not clear from your post which parts of the ListBox/ComboBox you are referring to.

1) For list Items:, you can specify a variable e.g. [myListItems] ... then populate it with values like ...
Code: Select all
SetVar "[myListItems]" "Apple[#13][#10]Banana[#13][#10]Cherry"


Note that "in the Windows Universe", "new lines" are coded with two characters ... [#13][#10] a.k.a "Carriage Return" and "Line Feed" ... something inherited from typewriters of the day where you ...

a) pushed a handle to return the print-carriage to the first position
b) advanced the knob to feed the paper one line up

2) For Variable: (to store selected item), if the ListBox is setup to accept multiple selections, Multiple items will be separated by [#13].

So far I tried StrReplace trying to replace Line Feed ([#10]) with Delete and all sorts but the list keeps the same.

Try this ...
Code: Select all
StrReplace "string" "old chars" "" "variable" ""

... and use [#13][#10] or [#13] for "old chars" as appropriate.
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: List to single line

Postby stu » Wed Mar 11, 2015 7:10 am

Hi gaev,

Legend! I was missing [#13], yes, that was it. thanks a lot!
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests