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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String manipulation

Status
Not open for further replies.
Mar 7, 2010
61
Hi, I have a string eg. WK-WOVENS. I want it to appear on my report as WK-Wovens. If I change it to proper case it appears as Wk-Wovens, so i need to somehow tell it to leave everything before the '-' as uppercase and everything after as propercase. Does anyone know how? FYI - there are not always 2 characters prior to the '-' there can be only 1. Hence why I need the before/after '-' instead of saying after 2 characters.

Thanks
Carleen
 
Try

if ubound(split({your.field},"-")) > 0 then
split({your.field},"-")[1]&"-"&propercase(split({your.field},"-")[2])
else {your.field}

Ian
 
I didn't start this thread but am learning from other folks' problems etc. So purely for interest/learning, can someone please help my understanding?

I don't understand the need for this statement in IanWaterman's solution:

if ubound(split({your.field},"-")) > 0

Does it basically do the same thing as the following (which I seems simpler for me to understand)?

if {your.field} like "*-*"

Thanks - hope I'm not upsetting anyone by asking !

J
 
There are multiple ways of testing for the presence of a hyphen, so yes, you could use your approach. Whatever is easier for or makes most sense to you in this case. Sometimes one approach is better than another because of processing speed.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top