iOS Question String functions library (similar to B4A/J)

Andrew Lindsay

Member
Licensed User
is it possible to use the string functions library from B4A or B4J with iOS?

I need a mid$ function and the other functionality offered by this library.

Regards
Andrew
 

Andrew Lindsay

Member
Licensed User
This library was written in B4A. If the source code of this library is available then you can use it from B4i.

If not then it should be difficult to implement the required methods as they are based on the built in API.
Erel,
I have downloaded the file from the forums, it gives an XML file and a JAR file. I assume that those do not help me at all with converting to a b4i library?

Regards
Andrew
 
Upvote 0

Andrew Lindsay

Member
Licensed User
Erel,
I' not sure that I follow your response. When I try to compile with the B4A string functions included as a library, i get the following error, with the main issue (to me) that the architecture is ARMV7, no the iPhone processor.
B4X:
Parsing code.                           0.00
Compiling code.                         0.09
Compiling layouts code.                 0.00
Compiling debugger engine code.         1.01
Building Xcode project                  0.00
Sending data to remote compiler.        Error
Out: Build settings from command line:
    ARCHS = armv7
    CODE_SIGN_IDENTITY = iPhone
    CONFIGURATION_BUILD_DIR = /Users/administrator/Documents/UploadedProjects/*******/Payload
    OTHER_CODE_SIGN_FLAGS = --keychain *******
    PRODUCT_NAME = B4i Example
    PROVISIONING_PROFILE = 9da7d5a2-d932-46de-92e2-88030105f21c

=== BUILD TARGET B4iProject OF PROJECT B4iProject WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
/bin/mkdir -p /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build
write-file /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-project-headers.hmap
/bin/mkdir -p /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7
write-file /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/B4i\ Example.LinkFileList
write-file /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-all-non-framework-target-headers.hmap
write-file /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-own-target-headers.hmap
write-file /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example.hmap
write-file /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-generated-files.hmap
write-file /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-all-target-headers.hmap

Create product structure
/bin/mkdir -p /Users/administrator/Documents/UploadedProjects/*******/Payload/B4i\ Example.app

ProcessInfoPlistFile Payload/B4i\ Example.app/Info.plist B4iProject/B4iProject-Info.plist
    cd /Users/administrator/Documents/UploadedProjects/*******
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    builtin-infoPlistUtility /Users/administrator/Documents/UploadedProjects/*******/B4iProject/B4iProject-Info.plist -genpkginfo /Users/administrator/Documents/UploadedProjects/*******/Payload/B4i\ Example.app/PkgInfo -expandbuildsettings -format binary -platform iphoneos -o /Users/administrator/Documents/UploadedProjects/*******/Payload/B4i\ Example.app/Info.plist

CompileC build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/main.o B4iProject/main.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/administrator/Documents/UploadedProjects/*******
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DNS_BLOCK_ASSERTIONS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility=hidden -Wno-sign-conversion -miphoneos-version-min=7.0 -iquote /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/*******/Payload/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/armv7 -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/*******/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/main.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/main.dia -c /Users/administrator/Documents/UploadedProjects/*******/B4iProject/main.m -o /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/main.o

CompileC build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/b4i_main.o B4iProject/b4i_main.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/administrator/Documents/UploadedProjects/*******
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DNS_BLOCK_ASSERTIONS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility=hidden -Wno-sign-conversion -miphoneos-version-min=7.0 -iquote /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/*******/Payload/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/armv7 -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/*******/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/b4i_main.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/b4i_main.dia -c /Users/administrator/Documents/UploadedProjects/*******/B4iProject/b4i_main.m -o /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/b4i_main.o
In file included from /Users/administrator/Documents/UploadedProjects/*******/B4iProject/b4i_main.m:2:
/Users/administrator/Documents/UploadedProjects/*******/B4iProject/b4i_main.h:2:9: fatal error: 'StringFunctions.h' file not found
#import "StringFunctions.h"
        ^
1 error generated.

CompileC build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/LS_playfair_4s_portrait.o B4iProject/LS_playfair_4s_portrait.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/administrator/Documents/UploadedProjects/*******
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DNS_BLOCK_ASSERTIONS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility=hidden -Wno-sign-conversion -miphoneos-version-min=7.0 -iquote /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/B4i\ Example-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/*******/Payload/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/armv7 -I/Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/*******/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/LS_playfair_4s_portrait.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/LS_playfair_4s_portrait.dia -c /Users/administrator/Documents/UploadedProjects/*******/B4iProject/LS_playfair_4s_portrait.m -o /Users/administrator/Documents/UploadedProjects/*******/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/LS_playfair_4s_portrait.o


Error: ** BUILD FAILED **


The following build commands failed:
    CompileC build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/b4i_main.o B4iProject/b4i_main.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Is it possible to use the StringFunctions 1.05 library with b4i or can I only use libraries written specifically for b4i? I'm not sure about the Java underneath the whole compile process...
Regards
Andrew
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
VB
txt = Mid(Text As String, BeginIndex As Int, Length As Int)
String index begins with 1.

B4A / B4i
txt = Text.SubString(BeginIndex As Int, EndIndex As Int)
BeginIndex inclusive, EndIndex exclusive.
String indexes begins with 0.

Examples:
VB
B4X:
Dim Text1, Text2 as String
Text1 = "0123456789"
Text2 = Mid(Test1, 3, 3) ' Result 234
B4A / B4i
B4X:
Dim Text1, Text2 as String
Text1 = "0123456789"
Text2 = Text1.SubString(2, 5) ' Result 234

When I learn a new language I adapt to the language and don't try to adapt the language to me :).

EDIT 2014.11.30:
Modified the VB example after the remark in the next post.
Mid(Test1, 2, 3) > Mid(Test1, 3, 3)
Added the String index values.
 
Last edited:
Upvote 0

Andrew Lindsay

Member
Licensed User
VB
txt = Mid(Text As String, BeginIndex As Int, Length As Int)

B4A / B4i
txt = Text.SubString(BeginIndex As Int, EndIndex As Int)
BeginIndex inclusive, EndIndex exclusive.

Examples:
VB
B4X:
Dim Text1, Text2 as String
Text1 = "0123456789"
Text2 = Mid(Test1, 2, 3) ' Result 234
B4A / B4i
B4X:
Dim Text1, Text2 as String
Text1 = "0123456789"
Text2 = Text1.SubString(2, 5) ' Result 234

When I learn a new language I adapt to the language and don't try to adapt the language to me :).
I agree, but sometimes it is good to use code that you already know that works.

For example, the VB example you give above, is incorrect, the correct return for that string would be '123', not '234', as VB is not 0 based for string position.

Regards
Andrew
 
Upvote 0

klaus

Expert
Licensed User
For example, the VB example you give above, is incorrect, the correct return for that string would be '123', not '234', as VB is not 0 based for string position.
You see I am more used to the current language, didn't remember that VB Strings are 1 based.

The B4A StringFunction library is a code module written by margret and compiled into a library.
Maybe ask margret if she would post the code module.
 
Upvote 0
Top