Skip to content
Codecrawl
All About Programming, Courses Available and Resources From Around The Web, All for the Purpose of Learning

Primary Menu

  • Tutorials
  • WordPress Dev
  • Forums
  • Resources
    • References

Breadcrumbs

  • Home
  • 2015
  • December
  • 7
  • Swift: Getting the length of a string
Posted on December 7, 2015Author daryl

Swift: Getting the length of a string

This entry is part 13 of 41 in the series Swift

Here is a simple function that will count the number of characters in a string.

import UIKit


func count(person: String) {
    let greeting = person
    print(greeting.characters.count)
}

count("Carol")

swift

Series Navigation<< Swift: A function that does not return anything
Swift: Class >>
Posted in Swift
Tagged character, count, string, swift

Post navigation

Previous Previous: Swift: A function that does not return anything
Next Next: Swift: Class

Primary Sidebar

Connect with:




Latest Series

    • React JS
    • Mac Programming
    • WPF Graphics
    • iOS Apps
    • Swift

Series



Other posts in series:

  • Swift: Variables
  • Swift: Specifying the type of variables
  • Swift: If else statement
  • Swift: While statement
  • Swift: Escaping a variable
  • Swift: An array of string
  • Swift: Associative array
  • Swift: Printing out an array
  • Swift: Printing out an associative array
  • Swift: Printing out the index in an array
  • Swift: A function that returns a string
  • Swift: A function that does not return anything
  • Swift: Getting the length of a string
  • Swift: Class
  • Swift: Class member initialization or Constructor
  • Swift editor from IBM
  • Swift: Inheritance
  • Swift: Getting the average
  • Swift: Test if an array is empty
  • Swift: Printing an incrementing number
  • Swift: Simple inheritance with a method
  • Swift: A struct with a closure
  • Swift: Else if
  • Swift Operators
  • Swift: Adding and inserting items to a list
  • Swift: Swapping of 2 variables
  • Swift: Switch and default case
  • Swift: Enum type
  • Swift: Saying hello with a closure
  • Swift: Testing if there are parameters in a function called
  • Swift: A simple struct
  • Swift: A simple rectangle struct
  • Shuffle array in a class
  • Swift: The 2 methods of writing a closure
  • Swift: Optional variable
  • Swift: Initialising parameters in a struct
  • Swift: Passing parameters in a function call
  • Swift: Declaring an array with the same value
  • Swift: Getting the average
  • Swift Programming Tutorial For Beginners 2015
  • Swift Tutorial

Popular Tags

array button C checkbox circle class constructor count css date dropdown effects event form function html image inheritance iOS JavaFX javascript jQuery line menu method mysql object PHP popup radio React ReactJS select selector slider sql static style swift table tabs validation variable variables while

Subsidiary Sidebar

Categories

Proudly powered by WordPress · Theme Toivo Lite by Foxland