How to add a "" in a string. String Manipulation Help.

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

How to add a "" in a string. String Manipulation Help.

Post by snop21 » Fri Feb 21, 2014 4:49 am

guys,


I already solved my problem on displaying the data from my query and display it to the dialog box one at a time.. :))

-----> Credit to Klaus and FabricioRocha

But now my problem is how to put a quote on each result before and after the string.. it looks like this.. ---> Date ------> "Date"

Thank you guys


-snop21
Attachments
QueryMoBilePick.livecode.zip
(5.53 KiB) Downloaded 206 times

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: How to add a "" in a string. String Manipulation Help.

Post by Simon » Fri Feb 21, 2014 4:56 am

quote&Date&quote
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

Re: How to add a "" in a string. String Manipulation Help.

Post by snop21 » Fri Feb 21, 2014 5:34 am

Simon,

Thank you.. :))

I have followup question How can I put the result into a variable. I can't explain it. I will just put sample here

I have records for sample

ken1
ken2
ken3
ken4
ken5

i will make a loop for this to display is into dialogbox one at a time -------> which i got it already.

My question is how can I put this into a variable? looks like this

-------------> holder = "ken1" "ken2" "ken3" "ken4" "ken5" <--------------------

Thanks Simon

-snop21

snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

Re: How to add a "" in a string. String Manipulation Help.

Post by snop21 » Fri Feb 21, 2014 5:48 am

I want to came up like this

--------------------------------------------------
put "Head" & cr & "Member" into optionList
--------------------------------------------------

which I can use it into the mobilepick

But I want data in my option came from my database that's why I am trying to have string manipulation to be able to have this.

Thanks guys.

-snop21

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: How to add a "" in a string. String Manipulation Help.

Post by Simon » Fri Feb 21, 2014 6:29 am

Hi snop21,
I'm not sure if you have answered this or are you asking another question?
and
2014-02-20_2126.png
2014-02-20_2126.png (6.55 KiB) Viewed 5228 times
is this what you are calling a dialogbox? If it is we call it an Answer box or Answer dialog, please use these terms as it makes it easier to understand the questions. :)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

snop21
Posts: 90
Joined: Mon Jan 20, 2014 2:54 pm

Re: How to add a "" in a string. String Manipulation Help.

Post by snop21 » Fri Feb 21, 2014 7:50 am

Simon,


o0o0o0o0ps... I am very sorry.. yes, that's what I am referring to. Answer Dialog.


-Regards

-snop21

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to add a "" in a string. String Manipulation Help.

Post by Klaus » Fri Feb 21, 2014 2:16 pm

Hi snop21,

really not sure what your problem is:
Adding QUOTE to every line of your variable?
Turning a CR delimited list into a SPACE delimited list?

Explain what you want to do to yourself and you will surely
be able to translate it to "Livecode"!


Best

Klaus

P.S.
Looking at your last postings, I think you need some hints concerning repeat loops!

1. repeat with...

Code: Select all

...
repeat with i = 1 to the num of lines of fld XYZ
  ## do something with line i of fld XYZ

  ## LC does the counting for you when using "repeat with ..."
  ## So this is completely unneccessary:
  ## add 1 to i
end repeat
...
2. repeat for each line/item etc... tLine in tList
Here LC will NOT count the lines, that's why this is so fast, so If you need to "track" the linenumber
you need to add a counter and raise it in every loop
This loop is READ ONLY, means you CANNOT modify tLine in the loop!

Code: Select all

...
set itemdel to TAB

## Optional:
put 1 into tCounter
repeat for each line tLine in tList

   ## BAD, will give HIGHLY UNEXSPECTED RESULTS:
   ## put 22 into item 1 of tLine
   
  ## Do this -> use a variable with the content of tLine and modify that instead:
  put tLine into tLine2
  put 22 into item 1 of tLine2

  put tLine2 & CR after tNewList

  ## Optional
  add 1 to tCounter
end repeat
...

Post Reply