1- #if JAVA
1+ #if JAVA
22public typealias NativeString = java . lang . String
33public typealias NativeStringBuilder = java . lang . StringBuilder
44#elseif CLR
@@ -24,7 +24,7 @@ public struct SwiftString /*: Streamable*/ {
2424 nativeStringValue = " "
2525 }
2626
27- public init ( count : Int , repeatedValue c : Char ) {
27+ public init ( repeating c : Char , count : Int ) {
2828
2929 #if JAVA || ISLAND
3030 var chars = Char [ ] ( count)
@@ -40,7 +40,7 @@ public struct SwiftString /*: Streamable*/ {
4040 }
4141
4242 public convenience init ( _ c: Char ) {
43- init ( count : 1 , repeatedValue : c )
43+ init ( repeating : c , count : 1 )
4444 }
4545
4646 public init ( _ s: NativeString ) {
@@ -232,16 +232,20 @@ public struct SwiftString /*: Streamable*/ {
232232 return SwiftString . UTF8View ( string: nativeStringValue)
233233 }
234234
235- #if COCOA
236235 public var utf8CString : UTF8Char [ ] {
236+ #if CLR
237+ let result = System . Text. Encoding. UTF8. GetBytes ( nativeStringValue)
238+ #elseif ISLAND
239+ let result = RemObjects . Elements. System. Encoding. UTF8. GetBytes ( nativeStringValue, false )
240+ #elseif COCOA
237241 let utf8 = nativeStringValue. cStringUsingEncoding ( . UTF8StringEncoding)
238- let len = strlen ( utf8) + 1
242+ let len = strlen ( utf8) + 1
239243 let result = UTF8Char [ ] ( len)
240244 memcpy ( result, utf8, len)
241- return result
245+ #endif
246+ return result
242247 }
243- #endif
244-
248+
245249 public var utf16 : SwiftString . UTF16View {
246250 return SwiftString . UTF16View ( string: nativeStringValue)
247251 }
@@ -430,4 +434,4 @@ public struct SwiftString /*: Streamable*/ {
430434 return nil
431435 #endif
432436 }
433- }
437+ }
0 commit comments