Format:
Recent snippets matching tags of string
StringBuilder sb = new StringBuilder(); sb.Append("<html><head><style type='text/css'>p{font-family:Arial;font-size:12px;}</style></head><body></br></br>"); sb.Append(String.Format("<p>Dear {0},</p>", privateContact.Name)); sb.Append(String.Format("<p>{0} has started using the Natolli portal to process some of its bookings and has indicated you as being one of their clients.", business.BusinessName)); sb.Append("In order to take advantage of the services being provided you will need to create an account, which should only take two minutes of your time."); sb.Append("Once an account has been created and for future bookings you will then be able to; track the status of your reports, make bookings directly through the portal, view and download uploaded reports, photos, invoices and statements on line as soon as they are made available."); sb.Append("Members will be kept informed as and when new releases and features are made available."); string emailBody = sb.ToString();
10 Views
no comments
using System; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { //ავიღოთ რაიმე სტრინგი string s = "me miyvars samyaro imitom rom mze amodis da natels fens yovels"; //გადავიყვანოთ ბაიტების მასივში, რადგან Convert.ToBase64String ბაიტის მასივს იღებს პარამეტრად byte[] strBytes = Encoding.ASCII.GetBytes(s);//თუ გაქვთ უნიკოდური ტექსტი უნდა გამოიყენოთ შესაბამისი კლასი. მაგ Encoding.Unicode
23 Views
no comments
function getQueryStringParams( query ) {
var Params = {};
if ( ! query ) {return Params;}// return empty object
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split('=');
if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ' ');
12 Views
no comments
/// <summary> /// Allows setting of a value in a UrlEncoded string. If the key doesn't exist /// a new one is set, if it exists it's replaced with the new value. /// </summary> /// <param name="urlEncoded">A UrlEncoded string of key value pairs</param> /// <param name="key"></param> /// <param name="value"></param> /// <returns></returns> public static string SetUrlEncodedKey(string urlEncoded, string key, string value) {
199 Views
no comments
public static class Int32Extensions { /// <summary> /// Appends an ordinal to the given integer value. Reformatted from here: /// http://stackoverflow.com/questions/20156/is-there-an-easy-way-to-create-ordinals-in-c/20175#20175 /// </summary> /// <param name="value"></param> /// <returns></returns> public static string ToStringWithOrdinal(this int value) {
72 Views
no comments
param ([string] $filename) function splitString([string]$string, [int]$length) { $lines = @(); $stringLength = $string.Length; $position = 0; while ($position -lt $stringLength) {
172 Views
no comments
using System; using System.Configuration; namespace Microsoft.Samples.AspNet.Validators { class UsingRegexStringValidator { static void Main(string[] args) { // Display title.
209 Views
no comments
/// <summary> /// Splits the id seqence values. /// </summary> /// <param name="combinedArgs">The combined args.</param> /// <returns></returns> private int[] SplitIdSeqenceValues(object combinedArgs) { var args = new int[3]; static readonly Regex _argsSeperator = new Regex(@"\D+", RegexOptions.Compiled);
84 Views
1 comments
function truncate-string([string]$value, [int]$length) { if ($value.Length -gt $length) { $value.Substring(0, $length) } else { $value } }
265 Views
no comments
/// <summary> /// Fixes a plain text field for display as HTML by replacing carriage returns /// with the appropriate br and p tags for breaks. /// </summary> /// <param name="String Text">Input string</param> /// <returns>Fixed up string</returns> public static string DisplayMemo(string htmlText) { if (htmlText == null) return string.Empty;
106 Views
no comments
public static T EnumConverter<T>(string value) { return (T)Enum.Parse(typeof(T), value); }
68 Views
no comments
/// <summary> /// Extendendo string usando o proprio isnullorempty /// assim fica muito mais intuitivo /// </summary> /// <param name="txt"></param> /// <returns></returns> public static bool IsNullOrEmpty(this string txt) { return String.IsNullOrEmpty(txt); }
104 Views
no comments
/// <summary> /// Implementaçào do mesmo coalesce do SQL /// </summary> /// <param name="txt"></param> /// <param name="args">passe um numero infinito de string separadas por virgula</param> /// <returns></returns> public static string Coalesce(this string txt, params string[] args) { string value = string.Empty;
86 Views
no comments
/// <summary> /// Returns an abstract of the provided text by returning up to Length characters /// of a text string. If the text is truncated a ... is appended. /// </summary> /// <param name="Text">Text to abstract</param> /// <param name="Length">Number of characters to abstract to</param> /// <returns>string</returns> public static string TextAbstract(string Text, int Length) { if (Text.Length <= Length)
345 Views
2 comments
/// <summary> /// Generates a unique Id as a string of up to 16 characters. /// Based on a GUID and the size takes that subset of a the /// Guid's 16 bytes to create a string id. /// /// String Id contains numbers and lower case alpha chars 36 total. /// /// Sizes: 6 gives roughly 99.97% uniqueness. /// 8 gives less than 1 in a million doubles. /// 16 will give full GUID strength uniqueness
83 Views
no comments
/// <summary> /// Strips a string of any leading whitespace that exists /// for all lines of the string. /// </summary> /// <param name="code"></param> /// <returns></returns> public static string StripIndentation(string code) { // normalize tabs to 3 spaces string text = code.Replace("\t", " ");
80 Views
2 comments
public string GetCodeLines(string code, int count) { string[] lines = code.Split( new string[3] { "\r\n", "\n", "\r"}, StringSplitOptions.None ); string result = string.Join("\r\n", lines.Take(10).ToArray() ); return result; }
50 Views
no comments
string text = @" This is a long winded text demonstration of this funky text behavior."; string[] list = text.Split( new string[3] { "\r\n","\r","\n" }, 3,StringSplitOptions.RemoveEmptyEntries);
80 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
