zoukankan      html  css  js  c++  java
  • bit,byte,char,string区别与基本类型认识

    bit,byte,char,string区别与基本类型认识

    https://blog.csdn.net/aojiancc2/article/details/39479405

    bit(位):一个位就代表一个0或1(即二进制)

    byte(字节):是计算机信息技术用于计量存储容量和传输容量的一种计量单位,一个字节等于8位二进制数

    char(字符):所谓字符,即要表示某种含义的东西,而字节只是一个二进制码而已。那把某种含义得东西落实到1011***0011等二进制码得规则就叫编码规则。 比如ascill编码中 a转化为byte就是97

    string(字符串):一串字符而已

    java计算字符串中数字个数的方法:

    [java] view plain copy
     
    1. public int countNum(String _str)  
    2.     {  
    3.          //转化为字节数组  
    4.          byte bt[] =_str.getBytes();  
    5.          int numcount = 0;  
    6.          for(int i=0;i<bt.length;i++)  
    7.          {  
    8.              if(bt[i]>='0' && bt[i]<='9') //和0到9的字符比较,注意这里需要加上单引号不然他是直接比较,而不是把字符转化为字节在比较  
    9.              {  
    10.                  numcount++;  
    11.              }  
    12.          }  
    13.          return numcount;  
    14.     }  



    其实int是可以存一个汉字的

    比如 int x = '男';

    因为右边是一个char,char是可以自动转化为int的

    http://zhidao.baidu.com/link?url=SGv4lKOTo60y4t-RaGiKwAWScTDu0TJYFqAFktcyq_7FRQmg18bucKXq-30mckBjKYQQt6exPSAutEGLjNehpq

    http://blog.sina.com.cn/s/blog_68a1582d0100lors.html

      

     Unicode 和 UTF-8 有何区别

     https://www.zhihu.com/question/23374078

  • 相关阅读:
    scala中List、Array、ListBuffer、ArrayList、Set
    Spark Pipeline
    Spark MLlib
    minikube
    proxychains 安装
    网络性能测试
    Flexvolume
    kubectl 获取信息
    centos7 莫名重起的问题
    fio 测试磁盘
  • 原文地址:https://www.cnblogs.com/handsome1013/p/9209438.html
Copyright © 2011-2022 走看看