Ensure End With SemiColon : String Search « Data Types « C# / C Sharp






Ensure End With SemiColon

   

using System;
using System.Collections.Generic;
using System.Text;


internal static class Util
{
    internal static string EnsureEndWithSemiColon(string value)
    {
        if (value != null)
        {
            int length = value.Length;
            if ((length > 0) && (value[length - 1] != ';'))
            {
                return (value + ";");
            }
        }
        return value;
    }
}

   
    
    
  








Related examples in the same category

1.Search stringsSearch strings
2.use the IndexOf() and LastIndexOf() methods to search for substrings and characters;
3.String search: last indexString search: last index
4.String search DemoString search Demo
5.String split and searchString split and search
6.String Starts With
7.Checks whether the string starts with a number or not
8.Checks whether the string starts with an alphabet or not
9.Finds a given string and enclosing it with tags provided.