3786
Views
7
Comments
Solved
Replace Text function
Question

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



2020-02-28 09-46-54
Eduardo Jauch
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.

2014-10-21 20-15-17
Alberto Ferreira

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



2022-06-06 22-12-31
Tsuyoshi Kawarasaki

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

2024-12-19 12-19-39
Amal
 
MVP

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

2024-12-19 12-19-39
Amal
 
MVP

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. 

2022-06-06 22-12-31
Tsuyoshi Kawarasaki

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!

2014-10-21 20-15-17
Alberto Ferreira

Thanks Amal for your contribution with the forge component

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.