将字符数组转换为字符串 [英] Convert char array to String

查看:64
本文介绍了将字符数组转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Arduino 将字符数组转换为字符串?

How can I convert a char array to String with Arduino?

char charArray[];
String string = String(charArray); // This doesn't work

推荐答案

String 类型的初始化类似于 C 构造函数:

A String type is initialized similarly to a C constructor:

String randomString(charArray);

String 构造函数有多种重载,包括字符集合.

There are various overloads of the String constructor including char collections.

文档:

这篇关于将字符数组转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆