summaryrefslogtreecommitdiff
path: root/modules/string/src/c/convstr.c
blob: 5f1abf27de7df88f33a94482e6daf0c173e559d3 (plain)
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
46
47

/*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA - Cong WU
 * Copyright (C) INRIA - Allan CORNET
 *
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at
 * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 *
 */

/*--------------------------------------------------------------------------*/
#include <string.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include "gw_string.h"
#include "convstr.h"
/*--------------------------------------------------------------------------*/
void convstr(wchar_t **Input_Matrix, wchar_t **Output_Matrix, char typ, int mn)
{
    int x = 0;
    for (x = 0 ; x < mn; x++)
    {
        int y = 0;
        size_t len_Input_Matrix = wcslen(Input_Matrix[x]);
        for (y = 0; y < len_Input_Matrix; y++)
        {
            /*To traverse every string in the string matrix */
            if ( (typ == UPPER) || (typ == UPPER_B) )
            {
                /*converts the matrix of strings  str-matrix into upper case */
                Output_Matrix[x][y] = (wchar_t) towupper(Input_Matrix[x][y]);
            }
            else if ( (typ == LOW) || (typ == LOW_B) )
            {
                /*converts the matrix of strings  str-matrix  into lower case */
                Output_Matrix[x][y] = (wchar_t) towlower(Input_Matrix[x][y]);
            }
        }
        Output_Matrix[x][y] = 0;
    }
}
/*--------------------------------------------------------------------------*/