CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of string
SQL
CREATE PROC SearchAllTables
(
    @SearchStr nvarchar(100)
)
AS
BEGIN
    CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
 
    SET NOCOUNT ON
by Prithvi Ramana A   December 22, 2011 @ 6:46am
31 Views
no comments
 
C#
/// <summary>
/// Creates a Connection string from Conf.xml
/// </summary>
/// <param name="isEntityConnection">
/// The is Entity Connection.
/// </param>
/// <param name="serverName">
/// The server Name.
/// </param>
/// <param name="databaseName">
by Sigurður Bjarnason   October 10, 2011 @ 8:53am
48 Views
no comments
 
C++
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
by iscsi   July 26, 2011 @ 2:24am
60 Views
no comments
 
C#
// create date time 2008-03-09 16:05:07.123
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);
 
String.Format("{0:y yy yyy yyyy}", dt);  // "8 08 008 2008"   year
String.Format("{0:M MM MMM MMMM}", dt);  // "3 03 Mar March"  month
String.Format("{0:d dd ddd dddd}", dt);  // "9 09 Sun Sunday" day
String.Format("{0:h hh H HH}",     dt);  // "4 04 16 16"      hour 12/24
String.Format("{0:m mm}",          dt);  // "5 05"            minute
String.Format("{0:s ss}",          dt);  // "7 07"            second
String.Format("{0:f ff fff ffff}", dt);  // "1 12 123 1230"   sec.fraction
by Egli   July 24, 2011 @ 10:54pm
69 Views
no comments
 
C#
// Just two decimal places
String.Format("{0:0.00}", 123.4567);      // "123.46"
String.Format("{0:0.00}", 123.4);         // "123.40"
String.Format("{0:0.00}", 123.0);         // "123.00"
 
// Max. two decimal places
String.Format("{0:0.##}", 123.4567);      // "123.46"
String.Format("{0:0.##}", 123.4);         // "123.4"
String.Format("{0:0.##}", 123.0);         // "123"
by Egli   July 24, 2011 @ 10:51pm
71 Views
no comments
 
C#
[Mixin("String.prototype")]
public static class StringExtensions
{
    public static bool StartsWith(string value)
    {
        return ((string)Script.Literal("this")).IndexOf(value) == 0;
    }
}
by Bruno Figueiredo   October 13, 2010 @ 2:47pm
300 Views
1 comments
 
C#
/// <summary>
  /// Encrypts the conn string.   
  /// </summary>
  /// <remarks></remarks>
  public void EncryptConnString()
  {
 
      Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
      ConfigurationSection section = config.GetSection("connectionStrings");
      if (!section.SectionInformation.IsProtected)
by Gary Cline   September 22, 2010 @ 3:01pm
183 Views
no comments
 
var
  list: TStringList;
begin
  list := TStringList;
  try
    list.Add( 'Testando' );
    ListBox1.Items.Assign( list );
  finally
    list.free;
  end;
by Thiago Pedro   September 02, 2010 @ 4:05pm
204 Views
no comments
 
C#
/// <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,
by Rick Strahl   July 23, 2010 @ 5:20pm
298 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"
 
by Al Gonzalez   July 12, 2010 @ 4:39pm
255 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Collections.Specialized;
 
namespace WebControls
{
    /// <summary>
by Arjan   May 12, 2010 @ 4:34am
259 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
by Thom Lamb   May 03, 2010 @ 6:47am
244 Views
no comments
 
C#
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 */
by Robert Andersson   April 29, 2010 @ 4:53am
297 Views
no comments
 
C#
/// <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)
by Al Gonzalez   March 15, 2010 @ 11:05am
Tags: String, LINQ, Any
398 Views
no comments
 
C#
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
by Zviadi   February 10, 2010 @ 4:47am
250 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, ' ');
by pushp   January 21, 2010 @ 2:38am
272 Views
no comments
 
C#
/// <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)
{
by Rick Strahl   November 30, 2009 @ 4:07pm
559 Views
no comments
 
C#
// 2010-10-12: Code has moved to http://bitbucket.org/jonsagara/extensionmethods/
by Jon Sagara   November 02, 2009 @ 1:20pm
267 Views
no comments
 
param ([string] $filename)
 
function splitString([string]$string, [int]$length)
{
    $lines = @();
    $stringLength = $string.Length;
    $position = 0;
 
    while ($position -lt $stringLength)
    {
by David R. Longnecker   October 13, 2009 @ 11:00am
680 Views
no comments
 
C#
using System;
using System.Configuration;
 
namespace Microsoft.Samples.AspNet.Validators
{
  class UsingRegexStringValidator
  {
    static void Main(string[] args)
    {
      // Display title.
by Dean Weber   October 07, 2009 @ 7:01am
1578 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate