zoukankan      html  css  js  c++  java
  • 整数转字符串

    代码
            static string TransToString(int value)
            {
                
    int step = 1000000000;
                
    char[] results = new char[10];
                
    int index = 0;
                
    if (value < 0)
                {
                    results[index
    ++= '-';
                    value 
    = 0 - value;
                }
                
    while (value / step == 0)
                    step 
    /= 10;
                
    while (step!=0&&value / step >= 0)
                {
                    
    if (value / step > 0)
                    {
                        results[index
    ++= (char)('0' + value / step);
                        value 
    = value % step;
                        step 
    /= 10;
                    }
                    
    else if (value / step == 0)
                    {
                        results[index
    ++= '0';
                        step 
    /= 10;
                    }
                }           
                
    return new string(results, 0, index);
            }
  • 相关阅读:
    wcf 配置
    一般处理程序问题重命名后问题
    jQuery取得select选择的文本与值
    C# 读取excel
    ajax 跨域问题
    java转义字符
    oracle日期时间的加减法
    在MyEclipse中,jsp文件输入中文,文件不能保存
    转自JavaEye Oracle函数大全
    转Oracle数据类型及存储方式【F】
  • 原文地址:https://www.cnblogs.com/qixue/p/1665872.html
Copyright © 2011-2022 走看看