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

Replace Function

New Here ,
Aug 10, 2009 Aug 10, 2009

Hello All,
The code below does the following: It finds an item in Spanish (in this case it's GetBasket.options, 2) and adds `SPA` to the SKU code.

<cfif ListContains(GetBasket.options, 2)><option value="2"><cfset basketsku = GetBasket.SKU & "SPA"></option></cfif>

How do I do the following?

Instead of adding SPA at the end I need to replace a third character in the SKU with number 3. For example: the SKU code in English is 902013, but the SKU code for Spanish is 903013. As you can see the 3rd number is being replaced with 3. It will be standard for all items in Spanish. How do I modify the code above to replace the 3rd number with 3?

Thank you all very much in advance!

883
Translate
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
LEGEND ,
Aug 10, 2009 Aug 10, 2009

newString = left(oldString, 2) & "3" & right(oldString, len(oldString - 3);

Translate
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
New Here ,
Aug 10, 2009 Aug 10, 2009
LATEST

Thank you Dan very much. Would it be possible implement what you wrote into existing code that I provided above?

Thanks!

Translate
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