Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting a space between characters in a string

Status
Not open for further replies.

arunrr

Programmer
Oct 2, 2009
103
US
Hello,

Need assistance with a simple issue...

I need to convert STRING1 to STRING2

STRING1="ABCDEF"
STRING2="A B C D E F"

Need to insert a space between each char in the string.

Thanks a ton!
AR
 
Hello
Please disregard this thread. Issue is resolved.
Thanks,
AR
 
Thanks Feherke for the input.

First, I did this...

echo $STRING1 | sed 's/./ &/g;s/^ //'

However, the real issue was this was substituting a variable in a HTML page. Therefore, the final code...

echo $STRING1 | sed 's/./\ &/g;s/^ //'

AR
 
Hi

[tt][blue][small][ignore][off-topic][/ignore][/small][/blue][/tt]
Unless you goal is obfuscation ( I mean, stopping search engines to index that text ) would not be easier to achieve similar effect with the [tt]letter-spacing[/tt] CSS property ?
[tt][blue][small][ignore][/off-topic][/ignore][/small][/blue][/tt]

Feherke.
 
Feherke...

You have a point. I have too many variables in this script and therefore went this way. It works for now. I suppose this is a result of minimal HTML experience.

AR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top