xref: /aoo41x/main/sal/rtl/source/strimp.c (revision 647f063d)
1*647f063dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*647f063dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*647f063dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*647f063dSAndrew Rist  * distributed with this work for additional information
6*647f063dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*647f063dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*647f063dSAndrew Rist  * "License"); you may not use this file except in compliance
9*647f063dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*647f063dSAndrew Rist  *
11*647f063dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*647f063dSAndrew Rist  *
13*647f063dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*647f063dSAndrew Rist  * software distributed under the License is distributed on an
15*647f063dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*647f063dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*647f063dSAndrew Rist  * specific language governing permissions and limitations
18*647f063dSAndrew Rist  * under the License.
19*647f063dSAndrew Rist  *
20*647f063dSAndrew Rist  *************************************************************/
21*647f063dSAndrew Rist 
22*647f063dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "strimp.h"
25cdf0e10cSrcweir 
rtl_ImplGetDigit(sal_Unicode ch,sal_Int16 nRadix)26cdf0e10cSrcweir sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix )
27cdf0e10cSrcweir {
28cdf0e10cSrcweir 	sal_Int16 n = -1;
29cdf0e10cSrcweir 	if ( (ch >= '0') && (ch <= '9') )
30cdf0e10cSrcweir 		n = ch-'0';
31cdf0e10cSrcweir 	else if ( (ch >= 'a') && (ch <= 'z') )
32cdf0e10cSrcweir 		n = ch-'a'+10;
33cdf0e10cSrcweir 	else if ( (ch >= 'A') && (ch <= 'Z') )
34cdf0e10cSrcweir 		n = ch-'A'+10;
35cdf0e10cSrcweir 	return (n < nRadix) ? n : -1;
36cdf0e10cSrcweir }
37cdf0e10cSrcweir 
rtl_ImplIsWhitespace(sal_Unicode c)38cdf0e10cSrcweir sal_Bool rtl_ImplIsWhitespace( sal_Unicode c )
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 	/* Space or Control character? */
41cdf0e10cSrcweir 	if ( (c <= 32) && c )
42cdf0e10cSrcweir 		return sal_True;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 	/* Only in the General Punctuation area Space or Control characters are included? */
45cdf0e10cSrcweir 	if ( (c < 0x2000) || (c > 0x206F) )
46cdf0e10cSrcweir 		return sal_False;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	if ( ((c >= 0x2000) && (c <= 0x200B)) ||	/* All Spaces			*/
49cdf0e10cSrcweir 		 (c == 0x2028) ||						/* LINE SEPARATOR		*/
50cdf0e10cSrcweir 		 (c == 0x2029) )						/* PARAGRAPH SEPARATOR	*/
51cdf0e10cSrcweir 		return sal_True;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	return sal_False;
54cdf0e10cSrcweir }
55