MCPcopy Create free account
hub / github.com/ajkhoury/ReClassEx / SplitString

Function SplitString

ReClass/stdafx.cpp:857–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857int SplitString( const CString& input, const CString& delimiter, CStringArray& results )
858{
859 int iPos = 0;
860 int newPos = -1;
861 int sizeS2 = delimiter.GetLength( );
862 int isize = input.GetLength( );
863
864 CArray<INT, int> positions;
865
866 newPos = input.Find( delimiter, 0 );
867 if (newPos < 0)
868 return 0;
869
870 int numFound = 0;
871 while (newPos > iPos)
872 {
873 numFound++;
874 positions.Add( newPos );
875 iPos = newPos;
876 newPos = input.Find( delimiter, iPos + sizeS2 + 1 );
877 }
878
879 for (int i = 0; i <= positions.GetSize( ); i++)
880 {
881 CString s;
882 if (i == 0)
883 {
884 s = input.Mid( i, positions[i] );
885 }
886 else
887 {
888 int offset = positions[i - 1] + sizeS2;
889 if (offset < isize)
890 {
891 if (i == positions.GetSize( ))
892 s = input.Mid( offset );
893 else if (i > 0)
894 s = input.Mid( positions[i - 1] + sizeS2, positions[i] - positions[i - 1] - sizeS2 );
895 }
896 }
897
898 if (s.GetLength( ) > 0)
899 {
900 results.Add( s );
901 }
902 }
903 return numFound;
904}
905
906ULONG_PTR ConvertStrToAddress( CString str )
907{

Callers 1

ConvertStrToAddressFunction · 0.85

Calls 4

GetLengthMethod · 0.80
AddMethod · 0.80
FindMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected