Articles Posted in the " " Category

  • equals()

    equals()

    描述 比较两个字串是否相等。比较过程中会区分大小写,所以字串 hello 和字串 HELLO 是不同的。 语法 string.equals(string2) 参数 string : String 物件 (字串) string2 : 另一个 String 物件 (字串) 回传 true: 假如 string 字串与 string2 字串相同 false: 与上面相反 范例 - StringComparisonOperators See also - String - equalsIgnoreCase() - compareTo() 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and […]


  • endsWith()

    endsWith()

    描述 测试一个字串结尾和另一个字串结尾是否相同。 语法 string.endsWith(string2) 参数 string: String 物件 (字串) string2: 另一个 String 物件 (字串) 回传 true: 假如 string 字串的结尾与 string2 字串的结尾相同 false: 与上面相反 范例 - StringStartsWithEndsWith See also - String - startsWith() 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 […]


  • concat()

    concat()

    描述 结合两个字串成为一个新字串。第二组字串会接在第一组字串后面。 语法 string.concat(string2) 参数 string, string2: String 物件 (字串) 范例 - StringAppendOperator See also - String - String Addition operator 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public […]


  • compareTo()

    compareTo()

    描述 比较两个字串,看看两者之中谁在前面、后面或相同。过程中会取两字串的每个字元做 ASCII 值比较,举例来说,’a’ 会在 b 前面和 A 后面。另外,数字总是在字母前面。 语法 string.compareTo(string2) 参数 string: String 物件 (字串) string2: 另一个 String 物件 (字串) 回传 负值:假如 string 是在 string2 之前 0:假如 string 等于 string2 正值:假如 string 是在 string2 之后 范例 - StringComparisonOperators See also - String - equals() - equalsIgnoreCase() - == (comparison) 语法参考主页面 The text of the […]


  • charAt()

    charAt()

    描述 找到字串中指定位置的字元。 语法 string.charAt(n) 参数 string: String 物件 (字串) n: 指定的位置 回传 字串中第 n 个位置所在的字元 。 See also - String - setCharAt() - [] (element access) 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference […]


  • String()

    String()

    描述 建构一个 String 类别的实例。建构 String 时有多种型态,例如:不同的资料型别,包括以下: 用双引号包起来的字串常数 用单引号包起来的字元常数 其它 String 物件 一个整数 (int 型别) 常数或长整数 (long 型别) 常数 一个整数 (int 型别) 常数或长整数 (long 型别) 常数,并使用指定的进位表示法 (例如:二进制、八进制、十进制等等) 一个整数 (int 型别) 变数或长整数 (long 型别) 变数 一个整数 (int 型别) 变数或长整数 (long 型别) 变数,并使用指定的进位表示法 (例如:二进制、八进制、十进制等等) 用来表示数字的字串,预设是以十进位来表示,例如: String thisString = String(13) 你会得到字串 13。另外,你也可以使用其它进位表示法,例如: String thisString = String(13, HEX) 你会得到字串 D,它是用十六进制来表示十进制的数字 […]


  • 函式宣告

    函式宣告

    将程式码分割成多个函式区块可以让程式设计师更容易将程式码模组化,程式设计师可以将任务还有回传值定义在一个函式区块中,再让其他程式来 ”呼叫” 它们。传统的用法是,当在程式码内需要多次某种相同动作时就创建一个函式。 给习惯用 BASIC 的程式设计师,在 86Duino 中的函式提供 (还有扩充) 了一些子程式 (BASIC 中的 GOSUB)。 将程式码分割成函式具有下列几个优点: 函式让程式码本身更具组织性,也让程式码变的较概念化。 函式让一个动作被撰写在一个地方,所以这个函式只需要思考与除错一次就可以了。 这也减少在修改程式码过程中发生错误的机率。 函式让整个程式码变的比较小且紧密,因为再利用率变高了。 这样让再次利用别的程式码变得更容易也更模组化,副作用更少,还有可读性变更好。 setup() 与 loop() 是 Aruino 及 86Duino 必备的两个函式,其他的函式必须创建在这两个函式之外。举个例子,我们建立一个简单的函式去将两个数字相乘。 范例 “呼叫” 一个简单的乘法函式,我们传给它预想中的资料形态参数: 函式需要被宣告在任何的函式之外,因此 “myMultiplyFunction()” 要被宣告在 ”loop()” 上面或者下面。 整个程式码会像这样: 其他范例 这个函式会藉由 analogRead() 读取一个感测器五次并且计算五次读取值的平均。它把资料限制在 8 bit 之中 (0 到 255),并回传计算后的结果。 呼叫我们的函式只需要指派一个变数给它。 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the […]



  • double()

    double()

    描述 将一个值转换成 double 的资料型别。 语法 double(x) 参数 x: 任何型别的值 回传 double See also - double 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.


  • long double

    long double

    描述 86Duino 中支援 80-bit 扩展精度 (double extended) 的浮点数型别 long double,double extended 格式的表示范围从 3.65E−4951 到 1.18E+4932,虽然它并不是被设计用来精确的储存资料,不过它能减少浮点数在运算时的溢位以及舍入误差,进而提升浮点运算的精确度,更多的详细资料请参考 x86 扩展精度格式。 范例 long double myVar; long double sensorCalbrate = 1.117; 语法 long double var = val; var 变数名称 val 指派给变数的值 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is […]