js uppercase first letter
js uppercase first letter
const str = `abc`;
str.slice(0, 1).toUpperCase();
// "A"
str.slice(1).toLowerCase();
// "bc"
// js uppercase first letter
// capital / capitalization
const log = console.log;
const AutoUpperFirstIndexLetters = (str = ``, index = 1) => {
return str.slice(0, index).toUpperCase() + str.slice(index).toLowerCase();
}
// test
const str = `abcdefg`;
const result1 = AutoUpperFirstIndexLetters(str);
const result2 = AutoUpperFirstIndexLetters(str, 3);
log(`result1 =`, result1);
// result1 = Abcdefg
log(`result2 =`, result2);
// result2 = ABCdefg
refs
https://www.geeksforgeeks.org/how-to-make-first-letter-of-a-string-uppercase-in-javascript/
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有️xgqfrms, 禁止转载 ️,侵权必究️!
js uppercase first letter的更多相关文章
- js uppercase the first letter of string
js uppercase the first letter of string js String.toUpperCase `-webkit-border-image`.split(`-`).filt ...
- Codeforces Round #250 (Div. 2)A(英语学习)
链接:http://codeforces.com/contest/437/problem/A A. The Child and Homework time limit per test 1 secon ...
- Codeforces Round #290 (Div. 2) B. Fox And Two Dots dfs
B. Fox And Two Dots 题目连接: http://codeforces.com/contest/510/problem/B Description Fox Ciel is playin ...
- Codeforces Round #288 (Div. 2)D. Tanya and Password 欧拉通路
D. Tanya and Password Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/508 ...
- B. Fox And Two Dots
B. Fox And Two Dots time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- CF Fox And Two Dots (DFS)
Fox And Two Dots time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- The Unified Modeling Language(UML)
统一过程建模语言UML 统一过程建模语言UML是一种标准的可视化建模语言,使用在: 业务建模和类似的过程 居于软件系统的分析.设计.和实现 UML 是一门通用语言,提供给业务分析员,软件架构师和开发 ...
- cf437A The Child and Homework
A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input sta ...
- CodeForces - 508D Tanya and Password(欧拉通路)
Description While dad was at work, a little girl Tanya decided to play with dad characters. She has ...
随机推荐
- 善用tempfile库创建python进程中的临时文件
技术背景 临时文件在python项目中时常会被使用到,其作用在于随机化的创建不重名的文件,路径一般都是放在Linux系统下的/tmp目录.如果项目中并不需要持久化的存储一个文件,就可以采用临时文件的形 ...
- 用CSS制做一个三角形!
用CSS制做一个三角形! <style> .outer { width: 0; height: 0; border-left: 10px solid transparent; border ...
- 解决PHP无法监听9000端口问题/502错误解决办法
问题背景 配置nginx+php服务的时候,发现网站能打开html,打开php文件就显示502,一般这个是php没启动啊啥的导致不能正常解析php文件. 原因分析 因为nginx解析php文件是交给f ...
- 关于redis搭建环境
首先,window键+r 输入cmd进入dos命名窗口,我的redis是装在了d盘,so我得输入cd:或者d:进入d盘,cd\redis文件夹路径,这样的话,直接输入 redis-server -- ...
- QQ好友状态,QQ群友状态,究竟是推还是拉? 网页端收消息,究竟是推还是拉?
https://mp.weixin.qq.com/s/KB1zdKcsh4PXXuJh4xb_Zw 网页端收消息,究竟是推还是拉? 原创 58沈剑 架构师之路 2020-12-28 https:/ ...
- 防sql注入之参数绑定 SQL Injection Attacks and Defense 预处理语句与存储过程
http://php.net/manual/zh/pdo.prepared-statements.php 预处理语句与存储过程 很多更成熟的数据库都支持预处理语句的概念.什么是预处理语句?可以把它看作 ...
- PostgreSQL创建只读权限的用户
1.创建只读角色 CREATE ROLE readaccess; 2.授予对现有表的访问权限 GRANT USAGE ON SCHEMA public TO readaccess; GRANT SEL ...
- Be accepted for inclusion in the IEEE INFOCOM 2018 technical program
中了一篇INFOCOM,虽然不是一作但也是入学之后一直做的一份工作,算是没白下功夫吧.超声波定位这类工作,老实说,想应用到实际产品中,还是有一段路要走的. 老实说我也一直犹豫毕设的这套东西搞清楚了要不 ...
- linux系统资源限制———ulimit命令
简介 Linux ulimit命令用于控制shell程序的资源. ulimit为shell内建指令,可用来控制shell执行程序的资源 推荐:https://blog.csdn.net/skiwnc/ ...
- C++ 标准模板库(STL):vector
目录 1. vector 1.1 vector的定义 1.2 vector容器内元素的访问 1.3 vector 常用函数实例解析 1.4 vector的常见用途 1. vector 变长数组,长度根 ...