Hello

I would like to know if there is a  text function that allow me to change a caracter (in a position) by other caracter


Example:   I Have  "22120" and I want to change the 4th 2 by "4". To Get "22140"


I know the Replace function is a built-in function, but is not what i pretend



TIA



Solution

Hi Alberto.

You can do this concatenating two substr plus the text you want to replace, or try to use this component: https://www.outsystems.com/forge/component/2007/text-and-html-processing/

Never saw a "replace" by position as built in function (don't saying it does not exists in an extension that I don't know...)

There are also other text libraries in Forge, maybe one has what you want.

Cheers.

Solution

Thanks Eduardo, but the component that you sugest is a litle to much for the circunstance! :) 


I think that I will first sugestions ... concatenanting substr

By the way the Microsoft Power Query have...


Replaces length characters in a text value starting at a zero-based offset with the new text value.


Text.ReplaceRange(text as nullable text, offset as number, length as number, newText as text) as nullable text  


Thanks again



Yes, I also faced the similar situation. To modify JSON response and resolve ar error, I created the following extension.

https://www.outsystems.com/forge/component-overview/5106/text-util-2

Hi

Check out the forge component, I published which has a bunch of sting utilities. 

https://www.outsystems.com/forums/discussion/44364/string-utils-extension-for-web/

I will update the library with additional Replace functions

Regards

Amal Raj wrote:

Hi

Check out the forge component, I published which has a bunch of sting utilities. 

https://www.outsystems.com/forums/discussion/44364/string-utils-extension-for-web/

I will update the library with additional Replace functions

Regards


Hi 

I have updated the String Utils component with ReplaceRange function.

Also added a demo app to test the functions. 

Amal Raj wrote:

Amal Raj wrote:

Hi

Check out the forge component, I published which has a bunch of sting utilities. 

https://www.outsystems.com/forums/discussion/44364/string-utils-extension-for-web/

I will update the library with additional Replace functions

Regards


Hi 

I have updated the String Utils component with ReplaceRange function.

Also added a demo app to test the functions. 

Oh, that's what I wanted.

Thank you for the great improvement!

Thanks Amal for your contribution with the forge component