Hello,
Can a string be created having say a character “A” for N times? I mean create a string 5 times “A” i.e. “AAAAA”.
Thanks.
How long the string is expected to be. Will N be a very large number? In the example shared it is just 1 digit (5)
Is the letter to be repeated just any one character (mainly alphabet) or any other characters and multiple characters are possible?
N will be dynamic. And the character will be space or alphabet.
Regards,
Rajan Pachchigar
O2C Domain Lead, Domain Specialist (Agile delivery model | Commercial track)
Upcoming OOO: None
Holcim Services (South Asia) Limited
Reliable Tech Park , Empire Tower,
17th Floor South Block ,C & D Wing,
Airoli, Navi Mumbai- 400708
Mobile +91 99877 57109
rajan.pachchigar@lafargeholcim.com
www.lafargeholcim.com
Thanks. Could you update what you mean by dynamic? Is N likely to be at the most 1 digit (0-9) , 2 digit(0-99) or more than that?
N will be derived from some calculations and it could be two digits.
Regards,
Rajan Pachchigar
O2C Domain Lead, Domain Specialist (Agile delivery model | Commercial track)
Upcoming OOO: None
Holcim Services (South Asia) Limited
Reliable Tech Park , Empire Tower,
17th Floor South Block ,C & D Wing,
Airoli, Navi Mumbai- 400708
Mobile +91 99877 57109
rajan.pachchigar@lafargeholcim.com
www.lafargeholcim.com
Thank you. I am sure there will be more ingenious ways to achieve the needful. I hope, the below two could trigger some relevant ideas.
A) A basic , crude but working approach.
SUBSTITUTE(LEFT(“IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII”,[String Length]),“I”, [String Letter])
Here [String Length] is the desired output string length number ( N) , [String Letter] is the letter of which a new string needs to be built. The default string built here is of letter I and 50 characters long. One could concatenate or simply have default string length of 100 for N greater than 50
SUBSTITUTE(NUMBER(POWER(10, [String Length]))-1,9,[String Letter])
One could concatenate further as required. But the expression will grow longer.
Both the above will work on alphabets. I am unsure what results one expects by spaces. As a space as input will return space, as per my understanding.
I have to add say 5 space characters as preceding into a string say “ABCD” to make it " ABCD".
Please clearly describe what you want to accomplish so we can offer a specific suggestion.
Hello,
str1 = “ABCD”
N=5
Then str1 = " ABCD", i.e. I want to add 5 space characters at the beginning of str1.
If N=9,
Then str1 = " ABCD", i.e. I want to add 9 space characters at the beginning of str1.
To add leading spaces to a Text value:
RIGHT((" " & [text]), [length])
To add leading zeros to a Number, producing a Text value:
RIGHT(("00000" & [number]), [length])
The leading value (" "
and "00000"
above) must be at least as long as the length of the intended result.
There is no way to generate a character series of an arbitrary length; you must know the maximum possible length.
Thanks that was a great tip. I am use to the rept function in sheets so was surprised not to see it.
for my app I used left for giving a star rating in the description of a card
"Litter " & left(“”, [Litter]) & "
" & "Detritus " & left(“”, [Detritus]) & "
" & "Graffiti " & left(“”, [Graffiti]) &
User | Count |
---|---|
32 | |
31 | |
30 | |
19 | |
17 |