Replacing var with same lenght constants
- T24User
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 26
- Thank you received: 0
13 years 3 months ago - 13 years 3 months ago #10831
by T24User
Replacing var with same lenght constants was created by T24User
Hi,
I am trying to replace a variable of the same lenght of a different character.
X = "ABC"
I want it to be
X = "DDD"
I do not want to count the lenght of the variable and increment "D" in a loop.
The processing will take too long. I am looking for a function to do it.
how can I do this?
Thanks.
I am trying to replace a variable of the same lenght of a different character.
X = "ABC"
I want it to be
X = "DDD"
I do not want to count the lenght of the variable and increment "D" in a loop.
The processing will take too long. I am looking for a function to do it.
how can I do this?
Thanks.
Last edit: 13 years 3 months ago by T24User. Reason: more info
Please Log in or Create an account to join the conversation.
- T24User
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 26
- Thank you received: 0
13 years 3 months ago #10834
by T24User
Replied by T24User on topic Re: Replacing var with same lenght constants
STR is working fine... thanks
Please Log in or Create an account to join the conversation.
- durai611
- Offline
- Elite Member
-
Less
More
- Posts: 300
- Thank you received: 51
13 years 3 months ago #10835
by durai611
Replied by durai611 on topic Re: Replacing var with same lenght constants
I am sure that STR wont replace characters.
Please Log in or Create an account to join the conversation.
- Gigiipse
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 1
13 years 3 months ago - 13 years 3 months ago #10836
by Gigiipse
Replied by Gigiipse on topic Re: Replacing var with same lenght constants
"The STR function allows the duplication of a string a number of times."
I don't really understand what you want but CHANGE and EREPLACE are 2 functions used to replace chars/strings:
EXAMPLE
String1 = "Jim"
String2 = "James"
Variable = "Pick up the tab Jim"
CRT CHANGE( Variable, String1, String2)
CRT CHANGE( Variable, "tab", "check")
EXAMPLE
A = "AAABBBCCCDDDBBB"
PRINT EREPLACE (A,"BBB","ZZZ")
PRINT EREPLACE (A,"","ZZZ")
PRINT EREPLACE (A,"BBB","")
The output of this program is:
AAAZZZCCCDDDZZZ
ZZZAAABBBCCCDDDBBB
AAACCCDDD
I don't really understand what you want but CHANGE and EREPLACE are 2 functions used to replace chars/strings:
EXAMPLE
String1 = "Jim"
String2 = "James"
Variable = "Pick up the tab Jim"
CRT CHANGE( Variable, String1, String2)
CRT CHANGE( Variable, "tab", "check")
EXAMPLE
A = "AAABBBCCCDDDBBB"
PRINT EREPLACE (A,"BBB","ZZZ")
PRINT EREPLACE (A,"","ZZZ")
PRINT EREPLACE (A,"BBB","")
The output of this program is:
AAAZZZCCCDDDZZZ
ZZZAAABBBCCCDDDBBB
AAACCCDDD
Last edit: 13 years 3 months ago by Gigiipse.
Please Log in or Create an account to join the conversation.
- jpb
-
- Offline
- Moderator
-
- retired . . . ¯\_(ツ)_/¯
Less
More
- Posts: 2859
- Thank you received: 650
13 years 3 months ago #10846
by jpb
Replied by jpb on topic Re: Replacing var with same lenght constants
Does it mean your solution is as simple as
X = STR("D",LEN(X)) ???
X = STR("D",LEN(X)) ???
Please Log in or Create an account to join the conversation.
Time to create page: 0.030 seconds