string_language 0.0.8 → 0.0.801

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/string_helpers.rb +18 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7f79d274fd5b4e0c819b7390b8aa6f29fa0cdd6
4
- data.tar.gz: 61b51ec3f63a8ac7b9ee1b49718ca300f5e06c41
3
+ metadata.gz: af94783f6fbd58cc10b4296c9725d8de40934a9f
4
+ data.tar.gz: 203184262a806d02c44182b2ac783c38a2a5729e
5
5
  SHA512:
6
- metadata.gz: f7001e8ced170b53e154b3054203d36aea7aea5112311e2fbbc6d2d409e7a4b93cc654c63740d1f8fc040ea87057b331e5c04e7c72d12151f2ed5432132a580f
7
- data.tar.gz: e80b05c84923311e90992767cac8982d34b33db9113b3373c1a5cba8079667afe99b53ebf0fa3f021b21fcc9503520aca83373894d16c2a0252c6bcbfd49984d
6
+ metadata.gz: 97a8c1ee225c009b252a29fb856a58efff43aecb02faba87c5fa80dc6c88dacdc38697eb59f3b631adb4383c30b4580958069f2df6799b85825eb90aaa6d7ba5
7
+ data.tar.gz: 476e9502c9b4a1852fc75333b385c64d9abd9c1a95c7d24b80b0f05bc4a36e2737abd2b444ad5fcc837feb233ae1f9e5a3a8b9786f057ce432ba044189451a97
@@ -2,13 +2,23 @@ module StringHelpers
2
2
 
3
3
  def self.equalize stringA, stringB
4
4
 
5
- intermediateA = equalize_interpunction( stringA, stringB )
6
-
7
- equalize_surrounding_space( intermediateA, stringB )
5
+ step1 = equalize_interpunction( stringA, stringB )
6
+ step2 = equalize_surrounding_space( step1, stringB )
7
+ step3 = equalize_capitalization( step1, stringB )
8
8
  end
9
9
 
10
10
  private
11
11
 
12
+ def self.equalize_capitalization stringA, stringB
13
+
14
+ if stringB.match( /^[A-Z]/ ) and stringA.match( /^[a-z]/ )
15
+
16
+ return stringA.capitalize
17
+ else
18
+ return stringA
19
+ end
20
+ end
21
+
12
22
  # Return second string, with outer surrounding spacing like first string
13
23
  # @example
14
24
  # space_equally_surrounding( "gnu ", " gnat " ) => " gnu "
@@ -24,7 +34,7 @@ module StringHelpers
24
34
 
25
35
  def self.equalize_interpunction stringA, stringB
26
36
 
27
- interpunction = ".,:;'@|$%^&*-+={()}\/\\\\\#\"\\\[\\\]"
37
+ interpunction = "!?.,:;'@|$%^&*-+={()}\/\\\\\#\"\\\[\\\]"
28
38
  regex = /(\s*[#{interpunction}]\s*)/
29
39
 
30
40
  splitA = stringA.split( regex ) # "'a' ( bla ) (c )" => ["", "'", "a", "' ", "", "( ", "bla )", " (", "c )"]
@@ -46,11 +56,11 @@ module StringHelpers
46
56
  end
47
57
 
48
58
  # Quick Testing
49
- begin
50
- a = "(Dit is een, enigzins, wel (test) 'van' de spacing)"
51
- b = " ( Deze was niet goed gespaced, en zelfs , zoals ( test) ' van ' dittum) "
59
+ =begin
60
+ a = "Hallo (Dit is een, enigzins, wel (test) 'van' de spacing)!"
61
+ b = "hallo ( Deze was niet goed gespaced, en zelfs , zoals ( test) ' van ' dittum) ! "
52
62
 
53
63
  puts "correct: >#{a}<"
54
64
  puts "wrong: >#{b}<"
55
65
  puts "test: >#{StringHelpers::equalize( b, a )}<"
56
- end
66
+ =end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_language
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.801
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cornelis Adriaan Schippers