本文整理汇总了C#中String.ToUpper方法的典型用法代码示例。如果您正苦于以下问题:C# String.ToUpper方法的具体用法?C# String.ToUpper怎么用?C# String.ToUpper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String.ToUpper方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Remove
public override void Remove(String name) {
if (_iis7WorkerRequest == null) {
throw new PlatformNotSupportedException();
}
if (name == null) {
throw new ArgumentNullException("name");
}
if (_request != null) {
// delete by sending null value
_iis7WorkerRequest.SetRequestHeader(name, null /*value*/, false /*replace*/);
}
else {
_iis7WorkerRequest.SetResponseHeader(name, null /*value*/, false /*replace*/);
}
base.Remove(name);
if (_request != null) {
// update managed copy of server variable
HttpServerVarsCollection serverVars = _request.ServerVariables as HttpServerVarsCollection;
if (serverVars != null) {
serverVars.SynchronizeServerVariable("HTTP_" + name.ToUpper(CultureInfo.InvariantCulture).Replace('-', '_'), null, ensurePopulated: false);
}
// invalidate Params collection
_request.InvalidateParams();
}
}
示例2: SetHeader
internal void SetHeader(String name, String value, bool replace) {
Debug.Assert(_iis7WorkerRequest != null, "_iis7WorkerRequest != null");
if (name == null) {
throw new ArgumentNullException("name");
}
if (value == null) {
throw new ArgumentNullException("value");
}
if (_request != null) {
_iis7WorkerRequest.SetRequestHeader(name, value, replace);
}
else {
if (_response.HeadersWritten) {
throw new HttpException(SR.GetString(SR.Cannot_append_header_after_headers_sent));
}
// IIS7 integrated pipeline mode needs to call the header encoding routine explicitly since it
// doesn't go through HttpResponse.WriteHeaders().
string encodedName = name;
string encodedValue = value;
if (HttpRuntime.EnableHeaderChecking) {
HttpEncoder.Current.HeaderNameValueEncode(name, value, out encodedName, out encodedValue);
}
// set the header encoding to the selected encoding
_iis7WorkerRequest.SetHeaderEncoding(_response.HeaderEncoding);
_iis7WorkerRequest.SetResponseHeader(encodedName, encodedValue, replace);
if (_response.HasCachePolicy && StringUtil.EqualsIgnoreCase("Set-Cookie", name)) {
_response.Cache.SetHasSetCookieHeader();
}
}
// update managed copy of header
if (replace) {
base.Set(name, value);
}
else {
base.Add(name, value);
}
if (_request != null) {
// update managed copy of server variable
string svValue = replace ? value : base.Get(name);
HttpServerVarsCollection serverVars = _request.ServerVariables as HttpServerVarsCollection;
if (serverVars != null) {
serverVars.SynchronizeServerVariable("HTTP_" + name.ToUpper(CultureInfo.InvariantCulture).Replace('-', '_'), svValue, ensurePopulated: false);
}
// invalidate Params collection
_request.InvalidateParams();
}
}
示例3: GetUniqueColumns
public static HashSet<String> GetUniqueColumns(this H2Connection connection, String tableName)
{
// Reference : http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getIndexInfo(java.lang.String, java.lang.String, java.lang.String, boolean, boolean)
/*try {
var dbMeta = connection.connection.getMetaData();
var res = dbMeta != null ? dbMeta.getIndexInfo(null, null, tableName, true, false) : null;
if (res != null) {
var ret = new HashSet<String>();
while (res.next()) {
var columnName = res.getString(4);
ret.Add(columnName);
}
return ret;
}
} catch (Exception ex) {
Console.WriteLine(ex);
}*/
return new HashSet<String>(connection.ReadStrings("select column_list from INFORMATION_SCHEMA.CONSTRAINTS where constraint_type = 'UNIQUE' and upper(table_name) = '" + tableName.ToUpper() + "'"));
}
示例4: GetPrimaryKeysColumns
public static HashSet<String> GetPrimaryKeysColumns(this H2Connection connection, String tableName)
{
// Reference : http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String)
/*try {
var dbMeta = connection.connection.getMetaData();
var res = dbMeta != null ? dbMeta.getPrimaryKeys(null, null, tableName) : null;
if (res != null) {
var ret = new HashSet<String>();
while (res.next()) {
var columnName = res.getString(4);
ret.Add(columnName);
}
return ret;
}
} catch (Exception ex) {
Console.WriteLine(ex);
}*/
var ret = new HashSet<String>();
foreach (var list in connection.ReadStrings("select column_list from INFORMATION_SCHEMA.CONSTRAINTS where constraint_type = 'PRIMARY KEY' and upper(table_name) = '" + tableName.ToUpper() + "' ")) {
foreach (var col in list.Split(','))
ret.Add(col.Trim());
}
return ret;
}
示例5: GetColumnTypeCodes
public static Dictionary<String, int> GetColumnTypeCodes(this H2Connection connection, String tableName)
{
// Reference : http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String)
/*try {
var dbMeta = connection.connection.getMetaData();
var res = dbMeta != null ? dbMeta.getColumns(null, null, tableName, null) : null;
if (res != null) {
var ret = new Dictionary<String, int>();
while (res.next()) {
var columnName = res.getString(4);
var colType = res.getInt(5);
ret[columnName] = colType;
}
return ret;
}
} catch (Exception ex) {
Console.WriteLine(ex);
}*/
return connection.ReadMap<int>("select column_name, data_type from INFORMATION_SCHEMA.COLUMNS where upper(table_name) = '" + tableName.ToUpper() + "'");
}
示例6: SetHeader
internal void SetHeader(String name, String value, bool replace)
{
Debug.Assert(_iis7WorkerRequest != null, "_iis7WorkerRequest != null");
if (name == null)
{
throw new ArgumentNullException("name");
}
if (value == null)
{
throw new ArgumentNullException("value");
}
if (_request != null)
{
_iis7WorkerRequest.SetRequestHeader(name, value, replace);
}
else
{
if (_response.HeadersWritten)
{
throw new HttpException(SR.GetString(SR.Cannot_append_header_after_headers_sent));
}
// set the header encoding to the selected encoding
_iis7WorkerRequest.SetHeaderEncoding(_response.HeaderEncoding);
_iis7WorkerRequest.SetResponseHeader(name, value, replace);
if (_response.HasCachePolicy && StringUtil.EqualsIgnoreCase("Set-Cookie", name))
{
_response.Cache.SetHasSetCookieHeader();
}
}
// update managed copy of header
if (replace)
{
base.Set(name, value);
}
else
{
base.Add(name, value);
}
if (_request != null)
{
// update managed copy of server variable
string svValue = replace ? value : base.Get(name);
HttpServerVarsCollection serverVars = _request.ServerVariables as HttpServerVarsCollection;
if (serverVars != null)
{
serverVars.SynchronizeServerVariable("HTTP_" + name.ToUpper(CultureInfo.InvariantCulture).Replace('-', '_'), svValue);
}
// invalidate Params collection
_request.InvalidateParams();
}
}
示例7: FindCommandType
// 对FTP命令进行分类
public static FtpCommandType FindCommandType(String szCommand)
{
if (szCommand == null)
szCommand = "";
szCommand = szCommand.Trim();
szCommand = szCommand.ToUpper();
if (szCommand.Equals("USER")
|| szCommand.Equals("PASS")
|| szCommand.Equals("CWD")
|| szCommand.Equals("PWD")
|| szCommand.Equals("CDUP")
|| szCommand.Equals("DELE")
|| szCommand.Equals("MKD")
|| szCommand.Equals("RMD")
|| szCommand.Equals("REN")
|| szCommand.Equals("RNFR")
|| szCommand.Equals("RNTO")
|| szCommand.Equals("QUIT"))
return FtpCommandType.FtpControlCommand;
else if (szCommand.Equals("RETR")
|| szCommand.Equals("LIST"))
return FtpCommandType.FtpDataReceiveCommand;
else if (szCommand.Equals("STOR")
|| szCommand.Equals("STOU"))
return FtpCommandType.FtpDataSendCommand;
else
return FtpCommandType.FtpCommandNotSupported;
}