web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / insert a semi colon af...
Power Apps
Answered

insert a semi colon after every 10 digits

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a textbox.

If someone copys and paste numbers into this textbox i need to insert a Semi colon after every 10th digit  

i.e.

1421836968 1426031888 1426333858 1426110561 1426419152 1426316934 1426313930 1421800000 1456473342

becomes

1421836968;1426031888;1426333858;1426110561;1426419152;1426316934;1426313930;1421800000;1456473342

 

 

Thanks

fordraiders

Categories:
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @Anonymous, Your can use this formula:

    Concat(Split(TextInput1.Text," "),ThisRecord.Result&";")

     

     

    If my reply helped you, please give a 👍 , & if it solved your issue, please 👍 & Accept it as the Solution to help other community members find it more.


    I am primarily available on weekdays from 6-10 PM CT and 5-10 PM CT on weekends.


    Visit my Blog: www.powerplatformplace.com


     

     

  • BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    Hi @Anonymous ,

     

    Alternatively to the solution suggested by @AhmedSalih , you can use the Substitute function to substitute spaces with semicolons:

     

    Substitute(TextInput1.Text, " ", ";")
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks, What "property/method" does this go under ?

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    tried both formulas under "On Change" 

    (these are not datacard objects). unbound textboxes

     

     

    I do not see this addressed ?  the space will not always be there.

    "insert a semi colon after every 10 digits"

    DAVIDPOWELL_0-1677873509574.png

     

  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @Anonymous, you need to use the formula in the Default property of the InputText control.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I added a second textbox and put the formula in the Default property..  

    But i still need the formula to not assume i'm going to have a "SPACE" 

    I need:

    insert a semi colon after every 10 digits

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Looking at the screenshot you posted, its not just spaces, you've set up a multi-line text field, so you can have carriage return and line feed characters as well, also looks like you have double spaces... that's quite a challenge!

     

    However, all of the above conditions don't really matter if we instead just take out everything else except the numbers, split that into rows, add row numbers, then after every tenth we insert a semi-colon.

     

    To do this,

     

    The OnChange of your txt_OrderNumbers control becomes:

     

    Set(gblOldText, Self.Text)

     


    Then the Default property of the txt_OrderNumbers control becomes:

     

    Concat(
     ForAll(
     ForAll(
     Sequence(
     CountRows(
     Split(
     Concat(
     Split(
     gblOldText,
     ""
     ),
     If(
     IsMatch(
     Result,
     "[0-9]"
     ),
     Result
     )
     ),
     ""
     )
     )
     ),
     {
     ThisNum: Last(
     FirstN(
     Split(
     Concat(
     Split(
     gblOldText,
     ""
     ),
     If(
     IsMatch(
     Result,
     "[0-9]"
     ),
     Result
     )
     ),
     ""
     ),
     Value
     )
     ).Result,
     ThisRowNum: Value
     }
     ),
     ThisRecord.ThisNum & If(
     !(ThisRowNum = 0) && Mod(
     ThisRecord.ThisRowNum,
     10
     ) = 0,
     ";",
     ""
     )
     ),
     Value
    )

     

     

    If you are wondering why we have to move the original text to a variable, this is to avoid the circular reference caused by referencing itself.

     

    splitTenth.gif

     

    I have included a proof of concept app you can download and check for yourself 🙂

     

    Cheers,

    Sancho

  • Verified answer
    iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    @Anonymous

     

    I wrote a blog off the back of this, explaining my train of thought as I went through each step of this figuring it out - I also managed to get a better solution working that's neater.

     

    You can set your Text Input (the actual one that takes in the text from the user) to have an OnChange of:

    Set(
     gblOriginalTextValue,
     With(
     {
     CharacterString:
     Concat(
     Split(YourTextInput.Text,""),
     If(
     //If this item matches a digit
     IsMatch(Result,
     //here's where our regex goes
     "[0-9]"
     ),
     //Then use that value
     Result
     )
     )
     },
     With(
     {
     //Getting the number of valid characters to iterate through
     NumberOfValidCharacters: Len(CharacterString)
     },
     With(
     {
     //We split the valid string into characters
     // then take the character (Result)
     ValidCharacterArray: Split(CharacterString,"")
     },
     Concat(
     ForAll(
     Sequence(NumberOfValidCharacters),
     //Thing that happens for every item
     //We Take the FirstN Characters
     //Then we get the Last of that
     Last( FirstN( ValidCharacterArray, Value ) ).Result 
     &
     //Check if we are on the tenth character
     // by dividing by 10 and checking for the modulus (remainder)
     If(
     Mod(
     ThisRecord.Value,
     10
     ) = 0
     &&
     //Only add ; if this item is also not the last character
     !(
     ThisRecord.Value=NumberOfValidCharacters
     ),
     ";",
     ""
     )
     ),
     Value
     )
     )
     )
     )
    )

     

    Then set the Default property of that same Text Input control to:

    gblOriginalTextValue

     

    Cheers,

    Sancho

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @iAm_ManCat,

     

    First Thank you very much for the extreme extra effort to solve this issue !

    I completely forgot about the carriage returns.

    Glad the blog can probably help other folks in problems involving this area.

     

    Dave

     

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Happy to help Dave! This was actually quite a nice challenge, managed to get an extra-length teaching blog out of it in the end, teaching a bunch of different functions to (hopefully) some inquisitive app makers, so works out well for me too 🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard