[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-572628-105":53,"doc-detail-572628-en":127},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","core-c-and-net-quick-reference-arrays-string-operations-formatting-and-regex","Core C# and .NET Quick Reference - Arrays - String Operations - Formatting and Regex","","Core C# and .NET Quick Reference compiles practical snippets for common programming tasks: defining and using C# data types, working with arrays (sorting, clearing, copying, and sorting paired arrays), and performing core string operations such as comparison, searching, replacement, and splitting. It also covers numeric and date formatting via format specifiers, demonstrates System.Text.RegularExpressions with pattern matching examples, and includes utilities for string substring and StringBuilder usage, plus DateTime and TimeSpan construction and calculation.",{"@graph":63,"@context":119},[64,80,102],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":51,"@type":70,"position":76},"https://docshare.wps.com/template/general/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/core-c-and-net-quick-reference-arrays-string-operations-formatting-and-regex/572628/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/core-c-and-net-quick-reference-arrays-string-operations-formatting-and-regex/572628.png","ImageObject",442,249,{"name":88,"@type":89},"asda1da","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-21","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",6,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"What basic C# data types does this quick reference include and what are their sizes?","Question",{"text":109,"@type":110},"It lists common types such as string (2 bytes/char), bool, char, byte, short, int, long, float, double, and decimal along with representative example values and sizes.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"How does the document recommend sorting and manipulating arrays?",{"text":114,"@type":110},"It shows Array.Sort for ascending sorting, Array.Sort with index and length, Array.Clear to clear ranges, Array.Copy to copy between arrays, and sorting one array while carrying values from another via paired sorting.",{"name":116,"@type":107,"acceptedAnswer":117},"Which .NET tools are covered for string handling, formatting, and pattern matching?",{"text":118,"@type":110},"It covers string comparison and searching (e.g., IndexOf/LastIndexOf), replacement and splitting, StringBuilder for efficient concatenation and updates, String.Format numeric/date patterns, and Regex for validating or extracting patterns from text.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},572628,1792086184,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":50,"category_name":51,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":140,"read_time":9},3985747861852,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","Core C\\# and . NET  \nQuick Reference  \n1. Data Types  \nstring 2 bytes/char s = “reference”;  \nbool b = true;  \nchar 2 bytes ch = ‘a’ ;  \nbyte 1 byte b = 0x78;  \nshort 2 bytes Ival = 54;  \nint 4 bytes Ival = 540;  \nlong 8 bytes ival = 5400;  \nfloat 4 bytes val = 54.0F;  \ndouble 8 bytes val = 54.0D;  \ndecimal 16 bytes val = 54.0M;  \n2. Arrays  \nDeclaration  \nint[] numArray = {1903 , 1907 , 1910};  \nint[] numArray = new int[3];// 3 rows and 2 columns  \nint[ , ] nums = {{1907 , 1990} , {1904 , 1986} , {1910 , 1980}};  \nArray Operations  \nArray.Sort(numArray) ; // sort ascending // Sort begins at element 4 and sorts 10 elements Array.Sort(numArray, 4 , 10);  \n// Use one array as a key and sort two arrays string[] values = {“Cary”, “Gary”, “Barbara”} ;  \nstring[] keys = {“Grant”, “Cooper”, “Stanwyck”} ;  \nArray.Sort(keys, values);  \n// Clear elements in array (array, 1st element , \\# elements) Array.Clear(numArray, 0 , numArray.Length);  \n// Copy elements from one array to another Array.Copy(src , target, numelements) ;  \n3. String Operations  \nMethod  Description  \nCompare String.Compare(stra, strb, case, ci) bool case – true for case insensitive ci– new CultureInfo(“en-US”)  \nreturns: \u003C0 if a\u003Cb, 0 if a=b, 1 if a>b IndexOf str. IndexOf( val, start , num)  \nval– string to search for  \nstart – where to begin in string num – number of chars to search  \nreturns (–1) if no match. LastIndexOf Search from end of string.  \nReplace newstr= oldstr. Replace(“old”,”new”) ;  \nSplit Char[] delim= {‘ ‘, ‘,’} ;  \nstring w = “Kim , Joanna Leslie”;  \n// create array with three names string[] names= w.Split(delim) ;  \n\n| 6. Formatting Numeric and Date Values\u003Cbr>Format Item Syntax: {index[,alignment] [ :format string]}\u003Cbr>index – Specifies element in list of values to which format is applied.\u003Cbr>alignment– Indicates minimum width (in characters) to display value.\u003Cbr>format string – Contains the code that specifies the format of the displayed value. Example: String. Format(“Price is: {0:C2}”, 49.95); // output: Price is: $ 49.95\u003Cbr>a. Numeric Formatting |  |  |  |\n| --- | --- | --- | --- |\n| \u003Cbr>\u003Cbr>Format Specifier | \u003Cbr>Pattern\u003Cbr>| \u003Cbr>Value\u003Cbr>| \u003Cbr>Description\u003Cbr>|\n| C or c D or d E or e F or f N or n P or p R or r X or x\u003Cbr>{0:C2} , 1388.55\u003Cbr>{0:D5} , 45\u003Cbr>{0 ,9 :E2} , 1388.55\u003Cbr>{0 ,9 :F2} , 1388.55\u003Cbr>{0 ,9 :N1} , 1388.55 {0 ,9 :P3} , .7865 {0 ,9 :R} , 3.14159\u003Cbr>{0 ,9 :X4} , 31\u003Cbr>$ 1388 .55 00045\u003Cbr>1 .39+E 003 1388 .55\u003Cbr>1 , 388 .6\u003Cbr>78 . 650%\u003Cbr>3 .14159 001f\u003Cbr>Currency.\u003Cbr>Must be integer value.\u003Cbr>Must be floating point. Fixed Point representation. Insert commas\u003Cbr>Converts to percent. Retains all decimal places. Converts to Hex\u003Cbr>Example: CultureInfo ci = new CultureInfo(\"de-DE\"); // German culture\u003Cbr>string curdt = String. Format(ci,\"{0:M}\" , DateTime. Now) ; // 29 Juni\u003Cbr>b. DateTime Formatting: (January 19 , 2005 16:05:20) en-US |  |  |  |\n| Format   Value Displayed   Format   Value Displayed  \u003Cbr>|  |  |  |\n| d\u003Cbr>D\u003Cbr>f\u003Cbr>F\u003Cbr>g\u003Cbr>G\u003Cbr>M or m\u003Cbr>1/19/2005\u003Cbr>Wednesday, January\u003Cbr>19 , 2005 Wednesday, January\u003Cbr>19 , 2005 4 :05:20 PM Wednesday, January\u003Cbr>19 , 2005 4 :05 PM 1/19/2005 4 :05 PM 1/19/2005 4 :05:20 PM January 19\u003Cbr>Y or y t\u003Cbr>T\u003Cbr>s\u003Cbr>u\u003Cbr>U\u003Cbr>January, 2005\u003Cbr>4 :05 PM\u003Cbr>4 :05:20 PM\u003Cbr>2005-01-19T 16:05:20\u003Cbr>2005-01-19 16:05:20Z Wednesday, January 19 , 2005 21:05:20PM\u003Cbr>7. Using the System.Text. RegularExpressions. Regex class\u003Cbr>string zipexp = @ \"\\d{5}((-|\\s)?\\d{4})?$\" ;\u003Cbr>string addr=\"W.44th St, New York , NY 10017-0233\" ; Match m = Regex.Match(addr,zipexp) ; // Static method Regex zipRegex= new Regex(zipexp) ;\u003Cbr>m= zipRegex. Match(addr) ; // Use Regex Object\u003Cbr>Console.WriteLine(m.Value); // 10017-0233 |  |  |  |\n| Pattern\u003Cbr>| Description\u003Cbr>|  | \u003Cbr>Example\u003Cbr>|\n| + Match one or more occurrence ab+c matches abc, abbc\u003Cbr>* Match zero or more occurrences ab*c matches ac, abbc\u003Cbr>? Matches zero or one occurrence ab?c matches ac , abc\u003Cbr>\\d \\D Match decimal digit or non-digit (\\D) \\d\\d matches 01 , 55 \\","cbCaihXnBH0FNjDf","https://ap.wps.com/l/cbCaihXnBH0FNjDf","pdf",51244,"English","# Data Types\n# Arrays\n# String Operations\n## StringBuilder\n# DateTime and TimeSpan\n# System.Text.RegularExpressions (Regex)\n# Formatting Numeric and Date Values","[{\"question\":\"What basic C# data types does this quick reference include and what are their sizes?\",\"answer\":\"It lists common types such as string (2 bytes/char), bool, char, byte, short, int, long, float, double, and decimal along with representative example values and sizes.\"},{\"question\":\"How does the document recommend sorting and manipulating arrays?\",\"answer\":\"It shows Array.Sort for ascending sorting, Array.Sort with index and length, Array.Clear to clear ranges, Array.Copy to copy between arrays, and sorting one array while carrying values from another via paired sorting.\"},{\"question\":\"Which .NET tools are covered for string handling, formatting, and pattern matching?\",\"answer\":\"It covers string comparison and searching (e.g., IndexOf/LastIndexOf), replacement and splitting, StringBuilder for efficient concatenation and updates, String.Format numeric/date patterns, and Regex for validating or extracting patterns from text.\"}]","Core C# and .NET Quick Reference - Arrays - String Operations - Formatting and Regex | PDF",1791928553]