• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

replacing the letters in a string

LEGEND ,
Oct 01, 2007 Oct 01, 2007

Copy link to clipboard

Copied

I have an odd set of fields for properties for my client. Some have multiple
letters which correspond to a code table. How can I loop through the string
and replace the letters with words

For example

A = central air
B = ceiling fan
C = A/C Unit

If the field looks like 'ABC', it would be outputted to the page as 'central
air ceiling fan A/C Unit'

--
Wally Kolcz
MyNextPet.org
Founder / Developer
586.871.4126


TOPICS
Advanced techniques

Views

161

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 02, 2007 Oct 02, 2007

Copy link to clipboard

Copied

LATEST
You don't say how many unique letters you have, but I presume it is 26 or less. If that's the case, you could index an array that has been initialized with the words. See concept code below. It assumes only upper case letters.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation