-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.cxx
45 lines (40 loc) · 1.23 KB
/
utils.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "utils.h"
std::string ExtensionOfFile( std::string fileName )
{
std::string extension ;
extension = fileName.substr( fileName.find_last_of( "." ) + 1 ,
fileName.size() - fileName.find_last_of( "." ) + 1 ) ;
return extension ;
}
std::string ChangeEndOfFileName (std::string fileName, std::string change )
{
std::string extension = ExtensionOfFile( fileName ) ;
fileName.replace( fileName.end() - extension.length() - 1 , fileName.end() , change ) ;
return fileName;
}
std::vector< std::vector < std::string > > ConvertArray( std::vector< std::vector< float > > array )
{
std::vector< std::vector < std::string > > buffer ;
for( int i = 0 ; i < array.size() ; i++ )
{
std::vector< std::string > buff ;
for( int j = 0 ; j < array[i].size() ; j++ )
{
buff.push_back( Convert( array[ i ][ j ] ) ) ;
}
buffer.push_back( buff ) ;
}
return buffer ;
}
int FindMaxNbOfCols( std::vector< std::vector< std::string > > vecData )
{
int max = 0 ;
for( int i = 0 ; i < vecData.size() ; i++ )
{
if( vecData[ i ].size() > max )
{
max = vecData[ i ].size() ;
}
}
return max ;
}