当前位置:网站首页>Part 31 supplement (31) ECMAScript conversion to string and number
Part 31 supplement (31) ECMAScript conversion to string and number
2022-06-27 16:59:00 【Embedded workplace】
1、 Convert to string
// Convert to string// If no cardinality is specified ,toString() All output in decimal system ;
2、 Convert to numbers
// Convert to numbers//parseInt(): Convert the value to an integer ;//parseFloat(): Convert a value to a floating point number ;// Both methods can only be used for String type , Return values of other types are NaN;
3、 Code
import QtQuick 2.9
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
Component.onCompleted: {
// Convert to string
// If no cardinality is specified ,toString() All output in decimal system ;
var name = "fjf"
console.log(name.toString())
var age = 22
console.log(age.toString(2))
var isIf = false
console.log(isIf.toString())
// Convert to numbers
//parseInt(): Convert the value to an integer ;
//parseFloat(): Convert a value to a floating point number ;
// Both methods can only be used for String type , Return values of other types are NaN;
var num1 = parseInt("3.1415")
console.log(num1)
var num2 = parseFloat("3.1415")
console.log(num2)
}
}
边栏推荐
- Annual comprehensive analysis of China's audio market in 2022
- Kubernetes basic self-study series | introduction to ingress API
- Mode setting of pulseaudio (21)
- 关于VS2019C#如何建立登陆界面输入的用户名和密码需与Access数据库的记录相匹配
- Special function calculator
- 当发布/订阅模式遇上.NET
- 国家食品安全风险评估中心:不要盲目片面追捧标签为“零添加”“纯天然”食品
- How to improve it electronic equipment performance management
- #yyds干货盘点#简述chromeV8引擎垃圾回收
- 华为云DevCloud重磅发布四大新能力,创下国内两项第一
猜你喜欢

After the mobile phone, it was reported that Samsung also cut the output of TV and other home appliance product lines

鴻蒙發力!HDD杭州站·線下沙龍邀您共建生態

如何提升IT电子设备效能管理

Halcon: discrete digital OCR recognition

# Cesium实现卫星在轨绕行

Autodesk NavisWorks 2022 software installation package download and installation tutorial

EMQ helps Qingdao Yanbo build a smart water platform

字节跳动埋点数据流建设与治理实践
#yyds干货盘点#简述chromeV8引擎垃圾回收

鸿蒙发力!HDD杭州站·线下沙龙邀您共建生态
随机推荐
Qt5 signal and slot mechanism (basic introduction to signal and slot)
Unity 阴影——阴影平坠(Shadow pancaking)
d3dx9_ How to repair 33.dll? d3dx9_ What if 33.dll is lost?
Handling of difficult and miscellaneous problems during the installation and configuration of qt5.5.1 desktop version (configuring arm compilation Kit)
Oracle概念二
印象深刻的问题
How to modify / display GPIO status through ADB shell
Huawei cloud devcloud launched four new capabilities, setting two domestic firsts
当发布/订阅模式遇上.NET
Synchronization mechanism of dual namenodes
leetcode 200. Number of islands
Etcd可视化工具:Kstone部署(一),基于Helm快速部署
全面解析零知识证明:消解扩容难题 重新定义「隐私安全」
关于#mysql#的问题:问题遇到的现象和发生背景
Annual comprehensive analysis of China's audio market in 2022
Yyds dry inventory brief chrome V8 engine garbage collection
继手机之后 报道称三星也削减了电视等家电产品线的产量
The two trump brand products of Langjiu are resonating in Chengdu, continuously driving the consumption wave of bottled liquor
Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
The array of C language is a parameter to pass a pointer