published on in Framework
tags: Framework Hugo

Announcement

This post is just a test to verify the functional components of the new blog framework before migrating the old posts

1function toProper(str) {
2  return str.replace(
3    /(\w*\W*|\w*)\s*/g,
4    function(txt) {
5    return(txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase())
6    }
7  );
8}
9const properName = toProper("jane doe");
1string ToProperName(this string input)
2{
3   CultureInfo culture = Thread.CurrentThread.CurrentCulture;
4   TextInfo textInfo = culture.TextInfo;
5   return textInfo.ToTitleCase(txt)
6}
7   var message = "hello C#";
8   var properString = message.ToProper())
1def toProper(s):
2   return s.title()
3
4print(toProper("hello python"))
1package main
2import (
3		"fmt"
4		"strings"
5		)
6func main(){
7	fmt.Println(strings.Title("hello Go"))
8}
9
 1public final class StringHelper {
 2
 3    public static String toTitleCase(String text) {
 4
 5        StringBuilder titleCase = new StringBuilder(text.length());
 6        boolean nextTitleCase = true;
 7
 8        for (char c : text.toLowerCase().toCharArray()) {
 9            if (!Character.isLetterOrDigit(c)) {
10                nextTitleCase = true;
11            } else if (nextTitleCase) {
12                c = Character.toTitleCase(c);
13                nextTitleCase = false;
14            }
15            titleCase.append(c);
16        }
17
18        return titleCase.toString();
19    }
20
21}