Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

allowed filename characters swift

 extension String {
    func convertToValidFileName() -> String {
        let invalidFileNameCharactersRegex = "[^a-zA-Z0-9_]+"
        let fullRange = startIndex..<endIndex
        let validName = replacingOccurrences(of: invalidFileNameCharactersRegex,
                                           with: "-",
                                        options: .regularExpression,
                                          range: fullRange)
        return validName
    }
}
Comment

PREVIOUS NEXT
Code Example
Ruby :: see all rails routes in browser 
Ruby :: how to get tables list in rails 
Ruby :: how to remove columns from rails 
Ruby :: ruby file extension 
Ruby :: rails send test email 
Ruby :: hashwithindifferentaccess ruby 
Ruby :: rails image tag 
Ruby :: rails generate model 
Ruby :: rspec check if object of a class 
Ruby :: fibonacci sums ruby 
Ruby :: ruby gem dir 
Ruby :: ruby each with index 
Ruby :: ruby array has element 
Ruby :: how to get current month end date in ruby 
Ruby :: ruby connect database 
Ruby :: rails date format dd/mm/yyyy 
Ruby :: how to write CSV file in rails 
Ruby :: ruby generate uuid 
Ruby :: create a new hash from existing hash ruby 
Ruby :: rails filter hashes by key value 
Ruby :: rails add index specifc name 
Ruby :: ruby version from script 
Ruby :: how to destroy a generate in rails 
Ruby :: rails optional reference 
Ruby :: ruby constructors 
Ruby :: ruby for programmers 
Ruby :: next rails gem 
Ruby :: rails prevent division by zero 
Ruby :: rails multiple rescue 
Ruby :: ruby rails remove tmp/pids/server.pid 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =