Below is the sample code we can use for adding a newline after every occurrence of "@" symbol in the string in C#
using System;
using System.IO;
static class Program
{
static void Main()
{
WriteToFile
(
@"C:\test.txt",
"fkdfdsfdflkdkfk@dfsdfjk72388389@kdkfkdfkkl@jkdjkfjd@jjjk@",
"@"
);
/*
output in test.txt in windows =
fkdfdsfdflkdkfk@
dfsdfjk72388389@
kdkfkdfkkl@
jkdjkfjd@
jjjk@
*/
}
public static void WriteToFile(string filename, string text, string newLineDelim)
{
bool equal = Environment.NewLine == "\r\n";
//Environment.NewLine == \r\n = True
Console.WriteLine("Environment.NewLine == \\r\\n = {0}", equal);
//replace newLineDelim with newLineDelim + a new line
//trim to get rid of any new lines chars at the end of the file
string filetext = text.Replace(newLineDelim, newLineDelim + Environment.NewLine).Trim();
using (StreamWriter sw = new StreamWriter(File.OpenWrite(filename)))
{
sw.Write(filetext);
}
}
}
Below is the sample code we can use for adding a newline the string in X++
textContainer is a string which I'm used in my code to add my concatinated data.
if(textContainer)
textContainer += "\n"
fileData is a string variable and it will be holding my final return value
fileData += System.Text.RegularExpressions.Regex::Replace(textContainer,"\n", System.Environment::NewLine);
ReplyDeleteIt's really good article.. Thanks for sharing.
DevOps Training
DevOps Online Training
ReplyDeleteMulti Channel Inventory Management Software | ERP Gold
As more stores differentiate their sales functions and channels for income generation, inventory management becomes more and more difficult. Managing inventory for one or two stores can be simple, but managing multiple products in stock requires more insight and speed, and faster responses to the challenging trends. To cope up with those challenges,ERP gold inventory management software can be integrated with ecommerce marketplace Almost we cover all the ecommerce marketplace from ebay to amazon, to big commerce to shopify, to other online platforms. One of the most important thing is it is customizable as per business needs.
Features of ERP Gold's Order Management Software includes:
• It is cloud based with SSL connection
• Business Operation Integration
• Top Level Security with SSL
• Adaptability with fast deployment
• For more information, visit our website: https://www.erp.gold/small-business-inventory-software/
•
• Or Get in touch with us: 1-888-334-4472
• Address: Suite 183411, Shelby TWP, MI 48318
• Email us: support@erp.gold
multi channel inventory management software for online marketplace
https://www.erp.gold/multi-channel-inventory-management-software/
https://www.erp.gold/why-is-a-multi-channel-inventory-management-software-necessary-for-a-small-business/