RBASIC - Swap? (AREV Specific)
At 09 JAN 1998 01:04:23PM B Cameron wrote:
If in RBASIC I read in a string of data that I want to replace or swap char values, is there a function or subroutine within to do this easily.
For example
StringA=abc,def,gh,ijkl,mno"
SWAP "," WITH "" IN StringA
??
At 09 JAN 1998 01:15PM Victor wrote:
If in RBASIC I read in a string of data that I want to replace or swap char values, is there a function or subroutine within to do this easily.
There are two ways to do this.
SWAP string1 WITH string2 IN variable
swaps all occurrences of string1 with string2
CONVERT charlist1 TO charlist2 IN variable
does a character by character conversion, changing the first digit of charlist1 to the first digit of charlist2.
So, in your example:
StringA=abc,def,gh,ijkl,mno"
convert "," to "" in StringA would result in StringA=abcdefghijklmno".
CONVERT is much faster than SWAP, so use it when you can. However, frequently, you cannot use CONVERT because you are swapping strings, not characters.
P.S. The last couple of questions you have asked seem very basic and are covered well in the R/BASIC manual. Do you have a manual available? I'm not trying to discourage you from posting, but if you have a manual available, it seems to me that getting the answer there would be best.
At 09 JAN 1998 01:33PM B Cameron wrote:
Victor
Your right they are basic questions and I appreciate the response(s).
And no, I do not have a manual. I am on the road right now and need to convert a Great Plains file "yesterday" to aid in a application conversion.
I have not seen my manual for 4+ years and suspect someone walked with it. I would love to get another.
Thanks again.
B
At 13 JAN 1998 11:56AM jgrey1@aol.com wrote:
The syntax of your SWAP statement is correct). You cal also use CONVERT in conjunction with AREV variables, e.g. CONVERT @LOWER.CASE TO @UPPER.CASE IN VAR will convert everything in VAR to upper case.