Skip to content

Commit 7f50ec0

Browse files
committed
StringForge is born
1 parent 5f5327c commit 7f50ec0

20 files changed

+2270
-9
lines changed

Package.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import PackageDescription
55

66
let package = Package(
77
name: "StringForge",
8+
platforms: [
9+
.macOS(.v12),
10+
.iOS(.v15),
11+
],
812
products: [
913
// Products define the executables and libraries a package produces, making them visible to other packages.
1014
.library(
@@ -20,5 +24,8 @@ let package = Package(
2024
name: "StringForgeTests",
2125
dependencies: ["StringForge"]
2226
),
23-
]
27+
.executableTarget(
28+
name: "Examples",
29+
dependencies: ["StringForge"]
30+
)]
2431
)

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# StringForge
2+
3+
> StringForge is a Swift library crafted to provide powerful and versatile extensions for string manipulation, formatting, validation, detection, encoding, analysis, and more. This library offers a suite of tools that simplify common and complex string operations, making it easier for developers to handle everything from text styling to data extraction.
4+
5+
**Note**: StringForge has been developed with the aid of advanced AI, which contributed to 99% of the code. By leveraging AI-driven assistance, StringForge encapsulates robust functionality and follows modern Swift practices. It serves as an example of how AI can efficiently support code generation for high-quality software libraries.
6+
7+
## Installation
8+
9+
_To install StringForge using Swift Package Manager (SPM), add the following line to your Package.swift file under dependencies:_
10+
11+
```swift
12+
.package(url: "https://github.com/username/StringForge.git", from: "1.0.0")
13+
```
14+
15+
## Features
16+
17+
### Text Formatting
18+
19+
_StringForge provides convenient methods to apply Markdown-compatible formatting to strings. These extensions make it easy to add emphasis, style headers, and structure text, all while ensuring readability in markdown editors._
20+
21+
- Bold: Formats text as bold
22+
- Italic: Formats text as italic
23+
- Bold and Italic: Formats text as both bold and italic
24+
- Strikethrough: Formats text with a strikethrough
25+
- Headers: Adds header levels from H1 to H6
26+
27+
### Encoding and Decoding
28+
29+
_StringForge supports a variety of encoding schemes to help you transform text data for storage, transmission, or compatibility. It includes methods for URL encoding, Base64 encoding, Hex encoding, HTML encoding, and Binary encoding, as well as their corresponding decoding functions._
30+
31+
- URL Encoding and Decoding
32+
- Base64 Encoding and Decoding
33+
- Hex Encoding and Decoding
34+
- HTML Encoding and Decoding
35+
- Binary Encoding and Decoding
36+
37+
### Data Detection
38+
39+
_Detecting data patterns within text can be crucial for tasks such as extracting URLs, phone numbers, or addresses from input. StringForge includes NSDataDetector-based methods for robust data detection, as well as regular expression-based extraction functions for numbers, hashtags, mentions, and more._
40+
41+
- URL Extraction: Extracts URLs within text.
42+
- Phone Number Detection
43+
- Address Detection
44+
- Date Detection
45+
- Extracting Numeric, Alphanumeric, Uppercase, Lowercase, Symbols
46+
- HTML Tag Extraction
47+
- File Extension Extraction
48+
- Hashtag and Mention Detection
49+
50+
### Text Analysis and Metrics
51+
52+
_With built-in readability scores and similarity metrics, StringForge makes it easy to analyze and compare text data. Whether you need to gauge readability or measure string similarity, these features help quantify textual properties for further processing or display._
53+
54+
- Readability Scores (Flesch-Kincaid, Coleman-Liau, etc.)
55+
- Sentence, Word, and Syllable Counting
56+
- Levenshtein Distance Calculation
57+
- Jaccard Similarity Calculation
58+
- Hamming Distance Calculation
59+
- Luhn Algorithm Check for Validity
60+
61+
### String Transformation and Case Conversion
62+
63+
_StringForge offers a suite of case transformation utilities that allow you to adapt strings to various naming conventions, including camelCase, snake_case, PascalCase, kebab-case, and more. Additionally, you can apply transformations to remove spaces, punctuation, and special characters._
64+
65+
- Camel Case Conversion
66+
- Snake Case Conversion
67+
- Pascal Case Conversion
68+
- Kebab Case Conversion
69+
- Title Case Conversion
70+
- Slug Case Conversion
71+
- Removing Prefixes and Suffixes
72+
- Extracting and Removing Whitespace and Special Characters
73+
74+
### Static Utilities
75+
76+
_StringForge includes a range of static utility methods to simplify text-related tasks, from generating Lorem Ipsum placeholder text to quickly constructing URL components for testing or prototyping._
77+
78+
- Common URL Components
79+
- Common Placeholder Texts (e.g., Lorem Ipsum)
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
//
2+
// StringForgeREADME.swift
3+
// StringForge
4+
//
5+
// Created by Gabriele Pavanello on 07/11/24.
6+
//
7+
8+
9+
import Foundation
10+
import StringForge
11+
12+
@main
13+
struct StringForgeREADME {
14+
15+
static func main() async throws {
16+
print("Generating README.md file...")
17+
let readmeContent = StringForgeREADME.generateREADME()
18+
try readmeContent.write(to: URL(fileURLWithPath: "README.md"), atomically: true, encoding: .utf8)
19+
print("README.md file generated successfully!")
20+
}
21+
22+
static func generateREADME() -> String {
23+
// Title and Introduction
24+
let title = "StringForge".markdownHeader1
25+
let description = """
26+
StringForge is a Swift library crafted to provide powerful and versatile extensions for string manipulation, formatting, validation, detection, encoding, analysis, and more. This library offers a suite of tools that simplify common and complex string operations, making it easier for developers to handle everything from text styling to data extraction.
27+
28+
**Note**: StringForge has been developed with the aid of advanced AI, which contributed to 99% of the code. By leveraging AI-driven assistance, StringForge encapsulates robust functionality and follows modern Swift practices. It serves as an example of how AI can efficiently support code generation for high-quality software libraries.
29+
""".markdownBlockquote
30+
31+
// Installation Section
32+
let installationTitle = "Installation".markdownHeader2
33+
let installationInstructions = """
34+
To install StringForge using Swift Package Manager (SPM), add the following line to your Package.swift file under dependencies:
35+
""".markdownItalic
36+
let spmCode = ".package(url: \"https://github.com/username/StringForge.git\", from: \"1.0.0\")".markdownCodeBlock(language: "swift")
37+
let installationSection = [installationTitle, installationInstructions, spmCode].joined(separator: "\n\n")
38+
39+
// Features Section
40+
let featuresTitle = "Features".markdownHeader2
41+
42+
// Text Formatting
43+
let textFormattingTitle = "Text Formatting".markdownHeader3
44+
let textFormattingDescription = """
45+
StringForge provides convenient methods to apply Markdown-compatible formatting to strings. These extensions make it easy to add emphasis, style headers, and structure text, all while ensuring readability in markdown editors.
46+
""".markdownItalic
47+
let textFormattingFeatures = [
48+
"Bold: Formats text as bold".markdownBulletListItem,
49+
"Italic: Formats text as italic".markdownBulletListItem,
50+
"Bold and Italic: Formats text as both bold and italic".markdownBulletListItem,
51+
"Strikethrough: Formats text with a strikethrough".markdownBulletListItem,
52+
"Headers: Adds header levels from H1 to H6".markdownBulletListItem
53+
].joined(separator: "\n")
54+
55+
// Encoding and Decoding
56+
let encodingTitle = "Encoding and Decoding".markdownHeader3
57+
let encodingDescription = """
58+
StringForge supports a variety of encoding schemes to help you transform text data for storage, transmission, or compatibility. It includes methods for URL encoding, Base64 encoding, Hex encoding, HTML encoding, and Binary encoding, as well as their corresponding decoding functions.
59+
""".markdownItalic
60+
let encodingFeatures = [
61+
"URL Encoding and Decoding".markdownBulletListItem,
62+
"Base64 Encoding and Decoding".markdownBulletListItem,
63+
"Hex Encoding and Decoding".markdownBulletListItem,
64+
"HTML Encoding and Decoding".markdownBulletListItem,
65+
"Binary Encoding and Decoding".markdownBulletListItem
66+
].joined(separator: "\n")
67+
68+
// Detection
69+
let detectionTitle = "Data Detection".markdownHeader3
70+
let detectionDescription = """
71+
Detecting data patterns within text can be crucial for tasks such as extracting URLs, phone numbers, or addresses from input. StringForge includes NSDataDetector-based methods for robust data detection, as well as regular expression-based extraction functions for numbers, hashtags, mentions, and more.
72+
""".markdownItalic
73+
let detectionFeatures = [
74+
"URL Extraction: Extracts URLs within text.".markdownBulletListItem,
75+
"Phone Number Detection".markdownBulletListItem,
76+
"Address Detection".markdownBulletListItem,
77+
"Date Detection".markdownBulletListItem,
78+
"Extracting Numeric, Alphanumeric, Uppercase, Lowercase, Symbols".markdownBulletListItem,
79+
"HTML Tag Extraction".markdownBulletListItem,
80+
"File Extension Extraction".markdownBulletListItem,
81+
"Hashtag and Mention Detection".markdownBulletListItem
82+
].joined(separator: "\n")
83+
84+
// Analysis and Metrics
85+
let analysisTitle = "Text Analysis and Metrics".markdownHeader3
86+
let analysisDescription = """
87+
With built-in readability scores and similarity metrics, StringForge makes it easy to analyze and compare text data. Whether you need to gauge readability or measure string similarity, these features help quantify textual properties for further processing or display.
88+
""".markdownItalic
89+
let analysisFeatures = [
90+
"Readability Scores (Flesch-Kincaid, Coleman-Liau, etc.)".markdownBulletListItem,
91+
"Sentence, Word, and Syllable Counting".markdownBulletListItem,
92+
"Levenshtein Distance Calculation".markdownBulletListItem,
93+
"Jaccard Similarity Calculation".markdownBulletListItem,
94+
"Hamming Distance Calculation".markdownBulletListItem,
95+
"Luhn Algorithm Check for Validity".markdownBulletListItem
96+
].joined(separator: "\n")
97+
98+
// Transformation and Case Conversion
99+
let transformationTitle = "String Transformation and Case Conversion".markdownHeader3
100+
let transformationDescription = """
101+
StringForge offers a suite of case transformation utilities that allow you to adapt strings to various naming conventions, including camelCase, snake_case, PascalCase, kebab-case, and more. Additionally, you can apply transformations to remove spaces, punctuation, and special characters.
102+
""".markdownItalic
103+
let transformationFeatures = [
104+
"Camel Case Conversion".markdownBulletListItem,
105+
"Snake Case Conversion".markdownBulletListItem,
106+
"Pascal Case Conversion".markdownBulletListItem,
107+
"Kebab Case Conversion".markdownBulletListItem,
108+
"Title Case Conversion".markdownBulletListItem,
109+
"Slug Case Conversion".markdownBulletListItem,
110+
"Removing Prefixes and Suffixes".markdownBulletListItem,
111+
"Extracting and Removing Whitespace and Special Characters".markdownBulletListItem
112+
].joined(separator: "\n")
113+
114+
// Static Utilities
115+
let staticTitle = "Static Utilities".markdownHeader3
116+
let staticDescription = """
117+
StringForge includes a range of static utility methods to simplify text-related tasks, from generating Lorem Ipsum placeholder text to quickly constructing URL components for testing or prototyping.
118+
""".markdownItalic
119+
let staticFeatures = [
120+
"Common URL Components".markdownBulletListItem,
121+
"Common Placeholder Texts (e.g., Lorem Ipsum)".markdownBulletListItem
122+
].joined(separator: "\n")
123+
124+
// Aggregate Features
125+
let featureSections = [
126+
featuresTitle,
127+
textFormattingTitle, textFormattingDescription, textFormattingFeatures,
128+
encodingTitle, encodingDescription, encodingFeatures,
129+
detectionTitle, detectionDescription, detectionFeatures,
130+
analysisTitle, analysisDescription, analysisFeatures,
131+
transformationTitle, transformationDescription, transformationFeatures,
132+
staticTitle, staticDescription, staticFeatures
133+
].joined(separator: "\n\n")
134+
135+
// Putting It All Together
136+
return [title, description, installationSection, featureSections].joined(separator: "\n\n")
137+
}
138+
}

0 commit comments

Comments
 (0)