Format:
Recent snippets matching tags of string
var
list: TStringList;
begin
list := TStringList;
try
list.Add( 'Testando' );
ListBox1.Items.Assign( list );
finally
list.free;
end;
18 Views
no comments
/// <summary> /// Extracts a string from between a pair of delimiters. Only the first /// instance is found. /// </summary> /// <param name="source">Input String to work on</param> /// <param name="StartDelim">Beginning delimiter</param> /// <param name="endDelim">ending delimiter</param> /// <param name="CaseInsensitive">Determines whether the search for delimiters is case sensitive</param> /// <returns>Extracted string or ""</returns> public static string ExtractString(string source, string beginDelim,
24 Views
no comments
To Encrypt, run the following from the Visual Studio command prompt: aspnet_regiis -pe "connectionStrings" -app "/AppName" -prov "RsaProtectedConfigurationProvider" To Decrypt, run the following from the Visual Studio command prompt: aspnet_regiis -pd "connectionStrings" -app "/AppName"
46 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Collections.Specialized; namespace WebControls { /// <summary>
44 Views
no comments
<Extension()> _ Public Function EqualsAny(ByVal s As String, ByVal items As String, _ Optional ByVal sep As Char = ","c, _ Optional ByVal Comparison As StringComparison = CurrentCultureIgnoreCase) As Boolean Dim itemz As List(Of String) = items.Split(sep).ToList Dim idx = (From x In itemz Where s.Equals(x, Comparison) Select x).ToList EqualsAny = (idx.Count > 0) itemz = Nothing : idx = Nothing End Function
44 Views
no comments
int intValue = 1512; string stringValue = intValue.ToString("#,#", CultureInfo.GetCultureInfo(Thread.CurrentThread.CurrentCulture.Name)); /* Result in US English (en-US) will be 1,512 Result in Swedish (sv-SE) will be 1 512 */
66 Views
no comments
/// <summary> /// Determine if the specified string is blank, where blank is defined /// as null, empty or containing only whitespace characters. /// </summary> /// <param name="value">string to be evaluated</param> /// <returns> /// true if the value is null, empty or contains only /// whitespace characters; otherwise false /// </returns> static bool IsNullOrWhiteSpace(string value)
89 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
85 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, ' ');
63 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) {
275 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) {
119 Views
no comments
param ([string] $filename) function splitString([string]$string, [int]$length) { $lines = @(); $stringLength = $string.Length; $position = 0; while ($position -lt $stringLength) {
322 Views
no comments
using System; using System.Configuration; namespace Microsoft.Samples.AspNet.Validators { class UsingRegexStringValidator { static void Main(string[] args) { // Display title.
529 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);
112 Views
1 comments
function truncate-string([string]$value, [int]$length) { if ($value.Length -gt $length) { $value.Substring(0, $length) } else { $value } }
578 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;
160 Views
no comments
public static T EnumConverter<T>(string value) { return (T)Enum.Parse(typeof(T), value); }
114 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); }
144 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;
119 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)
442 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
112 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", " ");
104 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; }
86 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);
104 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
