Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
retko1985
Creator II
Creator II

if (first space), then someting.

How do I find first space in my string and replace it with something else.

Thank you.

5 Replies
sunny_talwar

May be this

Replace(String, ' ', '@')

tresesco
MVP
MVP

May be like:

=SubField(String, ' ',1) & 'ReplaceString' & Mid(String,Index(String,' ')+1)

However, an easier solution could be there. If hits, would let know.

zebhashmi
Specialist
Specialist

if (left(string,1)=" ",then

Anil_Babu_Samineni

Seems, Working this?

=SubField('Sa mpl e', ' ',1) & 'WEE' & Mid('Sa mpl e',Index('Sa mpl e',' ')+1)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Peter_Cammaert
Partner - Champion III
Partner - Champion III

From the array of possible solutions, here's another one:

=Left(String, Index(String, ' ')-1) & 'Substitute' & Right(String, Len(String)-Index(String, ' '))

Probably the only bonus is that this expression uses Left() for the left part, and Right() for the right part

If you prefer to first check for the occurrence of a space, you may want to do it like this:

=IF (Index(String, ' ') = 0,

     String,

     Left(String,Index(String,' ')-1) & 'Substitute' & Right(String,Len(String)-Index(String,' ')))