劉任昌Java套件Scanner,方法length(),charAt()
Java程式碼
import java.util.Scanner; /*開啟套件package util=utility用途,Scanner掃描器*/ /*蔡英文utility industry=公用事業產業,電力,自來水,效用=utility */ class MyClass { public static void main(String[] args) { String a, b=""; /*定義字串a,b */ Scanner myObj = new Scanner(System.in); /*建構掃描物件*/ System.out.print("輸入: "); a = myObj.nextLine(); /*輸入文字nextLine到變數a */ System.out.println("長度: " + a.length());/*輸出字串長度length() */ for (int i = 0; i < a.length(); i++) /*迴圈 */ b = a.charAt(i) + b; /*a字元順序放到b前面*/ System.out.println("輸出: "+ b); } }
Visual Studio Code程式開發環境
Java類別Classes/物件Objects
每一個類別或物件,包含屬性attributes與方法method。
JavaScript將輸入的字串顛倒輸出
輸入字串:
JavaScript將輸入的字串顛倒輸出程式碼
<p>輸入字串:<input type="text" len="50" id="in"></p><p><input type="button" value="執行JavaScript" onclick="f()"></p>
<p id="out"></p>
<script>
function f(){
var a = document.getElementById("in").value;/*取得id=in的文字*/
var b = "長度是:" + a.length + ",反串是: ";
var c = "";
for (var i = 0; i < a.length; i++)
c = a.slice(i,i+1) + c ;
b = b + c;
document.getElementById("out").innerHTML = b;
}
</script>
https://xdrcfvghyujiok8945656.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://d11150115.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://cindy-javascript.blogspot.com/2022/12/blog-post_29.html
回覆刪除https://yuzcc28.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://d11150116.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://lihtml-css-javascript-java.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://iuytjhg5261.blogspot.com/2022/12/blog-post_29.html
回覆刪除https://enchenghu0905.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://d11150108.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://www.blogger.com/blog/post/edit/preview/5444106583314177344/5391348772692489455
回覆刪除https://d11150114.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://tgyhjikolujik2554.blogspot.com/2022/12/javascannerlengthcharat.html
回覆刪除https://cindy-javascript.blogspot.com/2023/01/javascannerlengthcharat.html
回覆刪除https://d11150112.blogspot.com/2023/01/javascannerlengthcharat.html
回覆刪除https://643gjeytfru4312.blogspot.com/2023/01/javascannerlengthcharat.html
回覆刪除https://iuytjhg5261.blogspot.com/2023/01/h1bordersolid-8px-purple-javascript.html
回覆刪除https://danny1219.blogspot.com/2023/01/d11117226javascript.html
回覆刪除https://steven0918.blogspot.com/2023/01/d11117219javascript.html
回覆刪除作者已經移除這則留言。
回覆刪除https://www.blogger.com/blog/post/edit/8098460896125661899/4167256795233737060
回覆刪除https://zhangzheming920304.blogspot.com/2023/01/javalengthcharat.html
回覆刪除作者已經移除這則留言。
回覆刪除作者已經移除這則留言。
回覆刪除作者已經移除這則留言。
回覆刪除https://htm-css-javascript-java.blogspot.com/2023/01/d11117326javascript.html
回覆刪除https://ericlian-pc.blogspot.com/2023/01/d11117234javascriptjs-codejava.html
回覆刪除作者已經移除這則留言。
回覆刪除https://sophie0930307.blogspot.com/2023/01/d11117233javascript.html
回覆刪除https://sherryd11117110.blogspot.com/2023/01/d11117110javascript-js-cobejava.html
回覆刪除https://www.blogger.com/blog/post/edit/5577572625675926264/7320583077753022806
回覆刪除https://kai1115.blogspot.com/2022/12/javalengthcharatexcellenmid.html
回覆刪除