Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Change text from ALL CAPS to Title Case
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#R version 3.3.2 # We have a name in all caps that we want to change to Title Case. name="ANTHONEIL CHAMPAGNIE" # first convert all chars. to lowercase lc.name=tolower(name) maketitle = function(txt){ # function to convert a text string in lowercase to Title Case. theletters = strsplit(txt,'')[[1]] wh = c(1,which(theletters == ' ') + 1) theletters[wh] = toupper(theletters[wh]) paste(theletters,collapse='') } maketitle(lc.name)
[
+
]
Show input
Absolute running time: 0.37 sec, cpu time: 0.54 sec, memory peak: 30 Mb, absolute service time: 0,38 sec
edit mode
|
history
|
discussion
[1] "Anthoneil Champagnie"