kotlin 分割字符_Kotlin程序查找字符的ASCII值

kotlin 分割字符

Given a character, we have to find its ASCII value.

给定一个字符,我们必须找到其ASCII值。

Example:

例:

    Input:
    c = 'A'

    Output:
    65

在Kotlin中查找字符的ASCII值的程序 (Program to find ASCII value of a character in Kotlin)

package com.includehelp.basic

import java.util.*

//Main Function, entry Point of Program
fun main(args: Array<String>) {
    // InputStream to get Input
    val scanner = Scanner(System.`in`)

    //Input Character
    print("Enter Character : ")
    val c = scanner.next()[0]

    //Get Ascii Value of Character
    val ascii = c.toInt();

    //Print AscII Value
    println("ASCII Code of $c is $ascii");
}

Output

输出量

RUN 1:
Enter Character : A
ASCII Code of A is 65
---
Run 2:
Enter Character : a
ASCII Code of a is 97
---
Run 3:
Enter Character : 3
ASCII Code of 3 is 51
---
run 4:
Enter Character : #
ASCII Code of # is 35


翻译自: https://www.includehelp.com/kotlin/find-ascii-value-of-a-character.aspx

kotlin 分割字符

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值