I was having a strange requirements last days and one of them is this one:
we have a string and we want to add a separator after 8 digit.
Here is the post which help me to achieve the my solution:
http://stackoverflow.com/questions/9932096/add-separator-to-string-at-every-n-characters
Solution:
here is the solution that worked for me:
string x = "111111110000000011111111000000001111111100000000";
output should be :
"11111111,00000000,11111111,00000000,11111111,00000000,"
C# : Regex.Replace(myString, ".{8}", "$0,");
Javascript:
"111111110000000011111111000000001111111100000000".replace(/(.{8})/g,"$1,")
Subscribe to:
Post Comments (Atom)
The "Mark as Decorative" Feature in SharePoint: A Small Toggle With a Big Accessibility Impact
If you've spent any time building pages in SharePoint Online, you've probably noticed a new checkbox tucked inside the Accessibility...
-
In last blog we learn how can we enable footer on SharePoint Online Modern Communication site. If you have not gone through that you can use...
-
If you're managing SharePoint Online environments, there's a significant change on the horizon that you need to prepare for. Microso...
-
Issue : Recently, we had a requirement to sync the calendar between shared mailbox outlook and SharePoint Calendar list. We have created 2 f...
Adding a separator after every N characters is a useful string-manipulation technique, especially when working with fixed-length data formats. The example demonstrates how regular expressions can simplify this task in both C# and JavaScript. By matching groups of eight characters and appending a comma after each group, we can transform a continuous string into a more readable format.
ReplyDeleteFor developers looking to strengthen their JavaScript programming skills and explore practical coding techniques such as string manipulation, regular expressions, and working with text data, Javascript Online Training in India is a relevant learning resource.
Those who prefer a structured learning approach can also explore Javascript Online Course in India to build a foundation in JavaScript concepts and apply them to real-world programming problems.
ReplyDelete