The translator solves the problem of adding many double quotation marks from SQL to C #. Code Format and adjust. The length of each line is about 70.
Format # Region Format
Private String Formatstring = String . Empty;
Private Int Index = 0 ;
Private Stringbuilder sbword = New Stringbuilder ();
Char [] Splitc = New Char [] {' ','\ T','\ R','\ N'} ; // ',', '= ',
Char [] Splituse = New Char [] {',','='} ;
Private Bool Insplitc ( Char [] Splitc, Char C)
{
For ( Int I = 0 ; I < Splitc. length; I ++ )
{
If(C=Splitc [I])
Return True;
}
Return False ;
}
Private Char Peek ()
{
ReturnPeek (1);
}
Private Char Peek ( Int I)
{
If(Index+I> =Formatstring. length)
Return '\ 0';
ReturnFormatstring [Index+1];
}
/**/ /// <Summary>
///Returns a character group, keyword, variable, or string.
/// </Summary>
/// <Returns> </returns>
Private String Getaword ()
{
Sbword. Remove ( 0 , Sbword. Length );
Int Oldindex = Index;
Char C;
Char PC;
// Skip Blank
For (; Index < Formatstring. length; index ++ )
{
If(!Insplitc (splitc, formatstring [Index])
Break;
}
Oldindex = Index;
For (; Index < Formatstring. length; index ++ )
{
PC = Peek ();
C = Formatstring [Index];
If (Insplitc (splitc, c ))
Break ;
If (Insplitc (splituse, c ))
{
Break;
}
}
If (Oldindex < Index)
Return Formatstring. substring (oldindex, Index - Oldindex );
Else // If (oldindex = index)
{< br> If (index formatstring. length)
return formatstring [index +++ ]. tostring ();
else
return " \ n " ;
}
}
# Endregion
Download source code