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

How to search for a certain string of characters then move them to the back 1

Status
Not open for further replies.

borisbe

Technical User
Aug 15, 2005
73
0
0
US
I have titles that begin with certain words like "Non-major","Introduction to the","Introduction to", "Beginning", etc. and if a title begins with them then I want a comma and these words at the end of the title else just the title if they don't begin with these words. How is this completed? Also, I'm thinking that I should search for these words using UPPERCASE, in case, they are entered differently like "Non-major" or maybe entered like "Non-Major"(uppercase "M").

"Non-major Art" would be "Art, Non-Major"
"Beginning History of Art" would be "History of Art, Beginning"

Help is very appreciated.

Thank you
 
Lots of coding if there are a lot of instances of this but this will work

Code:
if instr(UPPERCASE({@YourFeild}),"NON-MAJOR") = 1 then 
    Propercase(mid({@YourFeild},10,len({@YourFeild})-9)) & ", " & "Non-Major" // 9 indicates the length 0f Non-Major 10 includes the space after 
else if instr(UPPERCASE({@YourFeild}),"BEGINNING") = 1 then 
    Propercase(mid({@YourFeild},10,len({@YourFeild})-9)) & ", " & "Beginning"
else {@YourFeild}

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
Thank you so much cospringsguy. I'll try it tomorrow when I get to work and give you an update.
 
CoSpringsGuy - The formula is wonderful but with just one little problem. Some titles have roman numeral numbers so "II", "III" etc. so the proper case is making them show as "Ii" instead of "II."

Thanks
 
take Propercase( and the ) just before the & out and run it like that. I just added output would look a little cleaner.

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top