ken bohnenkamp
24th April 2009, 15:41
I have a string that I want to assign to a variable x = This is the Deal "ABC1"
I need to include the quotes around ABC1 inside the variable. I have tried
x = "This is the Deal "ABC1"" but baan doesn't like that. Anyone know how to do this?
george7a
24th April 2009, 15:55
Hi,
You should put the quote twice like this:
x = "This is the Deal ""ABC1"""
- George
bdittmar
24th April 2009, 15:55
I have a string that I want to assign to a variable x = This is the Deal "ABC1"
I need to include the quotes around ABC1 inside the variable. I have tried
x = "This is the Deal "ABC1"" but baan doesn't like that. Anyone know how to do this?
Hello,
try this :
x = "this is the Deal"&"""&"ABC1"&"""
Regards
george7a
24th April 2009, 16:07
Hello,
try this :
x = "this is the Deal"&"""&"ABC1"&"""
Regards
No need to use the concatenation (&). The following will do:
x = "This is the Deal ""ABC1"""
~Vamsi
24th April 2009, 17:49
I have a string that I want to assign to a variable x = This is the Deal "ABC1"
I need to include the quotes around ABC1 inside the variable. I have tried
x = "This is the Deal "ABC1"" but baan doesn't like that. Anyone know how to do this?
See the Programmer's Reference:
http://www.baanboard.com/programmers_manual_baanerp_help_3gl_features_string_constants
andy_baijun
26th April 2009, 05:39
The quote character will be used as special to identify the string starting and ending. so, if you want to use the quota charactor " iteself in the string, you HAVE TO add the Quote " character before the Quote " in the string .
eg: " XXX""YYY"====>XXX"Y.
So, I full agree George 's solution.
and another way , useing & is another feasible method to do it.
Stuart
16th October 2009, 15:03
It seems that the above doesnt work for LN - it continually refuses to acknowledge the second "
george7a
16th October 2009, 15:08
Which one are you talking about?
The example I gave works in our LN.
Stuart
16th October 2009, 15:13
variable = ""A""" expecting the variable to hold "A" - would not compile
I used chr$(34) though - that works fine
eg
variable = chr$(34) & "A" & chr$(34) gives "A"
mark_h
16th October 2009, 15:52
variable = ""A""" has one too many "s on it. Is this a typo because I would expect ""A"" to work.
shah_bs
16th October 2009, 20:43
On the contrary, it has one too Few quote.
The following will work:
variable ="""A"""
and then the variable would contain "A"
The requirement is that if you need a quote in a variable, you need to 'protect' that quote with the help of one more 'body-guard' quote, and then enclose the whole string inside of the 'string terminator' quotes.
wiggum
19th October 2009, 12:29
In LN you can also use function quoted.string():
variable = quoted.string("A")
mark_h
20th October 2009, 14:22
shah_bs is correct. Wiggum that just takes the fun out of the whole post. :) Will have to keep that in mind to try on 4 - if I ever need a quoted string. Usually I am pulling out the extra "s and 's that people put in descriptions.