Home > Mobile >  The validation test?
The validation test?

Time:01-26

Public static string getStandFlowText (string STR)
{
STR=STR. Replace (" (", "(");
STR=STR. Replace (") ", ") ");
STR=STR. Replace (" ", "" (");
STR=STR. Replace ("] ", ") ");
STR=Regex. Replace (STR, @ ^ \ "" +", "", RegexOptions. The IgnoreCase);
STR=Regex. Replace (STR, @ ^ \ "$"," ", RegexOptions. The IgnoreCase);
STR=Regex. Replace (STR, @ "^ \ t +", "", RegexOptions. The IgnoreCase);
STR=Regex. Replace (STR, @ "\ t $"," ", RegexOptions. The IgnoreCase);
//delete all the bracket content
STR=dropBracket (STR);
//specification work step text
STR=replaceMainText (STR);
//remove redundant white space characters
STR=replaceMul (STR);
If (STR. The Contains (" \ t "))
{
String [] the items=STR. The Split (' \ t ');
If (items. The Length & gt;
=4){
STR=items [1] + "\ t" + items [2] + "\ t" + items [3].
}
Else if (items. Length & lt;=3 & amp; & The items. The Length & gt; 1)
{
STR=items [1].
}
}
return str;
}

Public static string replaceMul (string STR)
{
If (STR. The Contains (" \ t "))
{
String [] the items=STR. The Split (new string [] {} "\ t", StringSplitOptions. RemoveEmptyEntries);
STR=mergeStr (items, "\ t");
}
If (STR. The Contains (" "))
{
String [] the items=STR. The Split (new string [] {" "}, StringSplitOptions. RemoveEmptyEntries);
STR=mergeStr (items, "");
}
return str;
}

Public static string mergeStr (string [] items, string symbol)
{
String STR="";
for (int i=0; I & lt; The items. Length; I++)
{
STR +=items [I] the Trim () + symbol;
}
Return (STR) Equals (" "))? (" ") : (STR. The Substring (0, STR. Length - 1));
}

///& lt; Summary>
///delete the brackets to
///& lt;/summary>
///& lt; Param name="STR" & gt;
///& lt; Returns>
Public static string dropBracket (string STR)
{
Regex Regex=new Regex (@ \ "(. *) ", RegexOptions. The IgnoreCase);
While (regex. IsMatch (STR))
{
Int startIndex=1;
for (int i=0; I & lt; STR. Length; I++)
{
If (STR [I] the ToString (). The Equals (" ("))
{
StartIndex=I;
}
If (STR [I] the ToString (). The Equals (") ") & amp; & StartIndex & gt;=0)
{
STR=STR. Replace (STR. The Substring (startIndex, I - (startIndex - 1)), "");
}
}
}
return str;
}



Public static string replaceMainText (string STR)
{
STR=STR. Replace (" \ ""," ");
STR=STR. Replace (", ", "");
STR=STR. Replace (", ", "");
STR=STR. Replace (", ", "");
STR=STR. Replace (";" , "");
STR=STR. Replace (";" , "");
STR=STR. Replace (" '", "");
STR=STR. Replace (" : ", "");
STR=STR. Replace (" : ", "");
STR=STR. Replace (" \ ""," ");
STR=STR. Replace (" TO ", "");
STR=STR. Replace (" FOR ", "");
STR=STR. Replace (" I<=", "");
STR=STR. Replace (" I "or less," ");
STR=STR. Replace (" DCR ", "");
STR=STR. Replace (" THEN ", "");
STR=STR. Replace (" LESS ", "");
STR=STR. Replace (" AND ", "");
STR=STR. Replace (" @ ", "");
//STR=STR. Replace (" - ", "");
STR=STR. Replace (" at ", "");
STR=STR. Replace (" STAND BY ", "REST");
STR=STR. Replace (" constant voltage charging, "" CV");
STR=STR. Replace (" constant current charging ", "CC");
STR=STR. Replace (" constant exile electricity ", "DC");
STR=STR. Replace (" minutes ", "MIN");
STR=STR. Replace (" to ", "");
STR=STR. Replace (" to ", "");
STR=STR. Replace (" constant power charging ", "CP");
STR=STR. Replace (" constant power discharge ", "DP");
STR=STR. Replace (" constant pressure ", "CV");
STR=STR. Replace (" discharge ", "DC");
STR=STR. Replace (" charging ", "CC");
STR=STR. Replace (" sleep ", "REST");
STR=STR. Replace (" static ", "REST");
STR=STR. Replace (" sit ", "REST");
STR=STR. Replace (" on ", "REST");
STR=STR. Replace (" sampling interval ", "");
return str;
}
  • Related