Convert utf8 char in a NSString

Hi to all! I recieve from my server a XML file. I use NSXMLParser to retrieve attributes and values. The problem is this: i've many utf8 encoded char in many attributes, and i recieve them in NSStrings.
//in - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict DELEGATE
NSString *myAttribute = [[NSString alloc] initWithString:[attributeDict valueForKey:@"attribute"]];
The NSString at key "attribute" can contain UTF8 char as ò and similar.
How can i decode them to obtain a NSString with ò instead of ò and so on?

I understood that you helped me, I will need to use
parseInt to convert the string to number...No.
Assuming you've got the "15:00" part, say in a String called timeStr, you'd just pass that to dateFormat.parse(timeStr)
but I
need to know where in the String are my numbers...
isn't it? How may I do this? Well, that depends.
What's your logic for finding it manually? Is it the first occurrence of any numerical digit in the string? Is it at a known, fixed character index? Some other logic?

Similar Messages

  • How to find data dictionary and oracle schema tables for UTF8 char conversi

    I am doing UTF8 char conversition, i got lot of convertable objects,as per document we don't need to worry about data dictionary objects and how to find data dictionary and oracle schema objects for UTF8 char conversition.
    USER.TABLE Convertible Truncation Lossy
    MDSYS.OPENLS_NODES 17 0 0
    MDSYS.SDO_COORD_OP_PARAM_VALS 200 0 0
    MDSYS.SDO_GEOR_XMLSCHEMA_TABLE 1 0 0
    MDSYS.SDO_STYLES_TABLE 78 0 0
    MDSYS.SDO_XML_SCHEMAS 3 0 0
    ORDDATA.ORDDCM_CT_PRED_OPRD 51 0 0
    ORDDATA.ORDDCM_DOCS 9 0 0
    ORDDATA.ORDDCM_MAPPING_DOCS 1 0 0
    SYS.METASTYLESHEET 178 0 0
    SYS.REGISTRY$ERROR 2 0 0
    SYS.RULE$ 21 0 0
    SYS.SCHEDULER$_EVENT_LOG 182 0 0
    SYS.WRH$_SQLTEXT 2,099 0 0
    SYS.WRH$_SQL_PLAN 1,736 0 0
    SYS.WRI$_ADV_ACTIONS 5,452 0 0
    SYS.WRI$_ADV_DIRECTIVE_META 5 0 0
    SYS.WRI$_ADV_OBJECTS 2,278 0 0
    SYS.WRI$_ADV_RATIONALE 9,594 0 0
    SYS.WRI$_ADV_SQLT_PLANS 455 0 0
    SYS.WRI$_ADV_SQLT_PLAN_STATS 288 0 0
    SYS.WRI$_DBU_FEATURE_METADATA 188 0 0
    SYS.WRI$_DBU_FEATURE_USAGE 16 0 0
    SYS.WRI$_DBU_HWM_METADATA 20 0 0
    SYS.WRI$_REPT_FILES 27 0 0
    XDB.XDB$DXPTAB 2 0 0
    XML CSX Dictionary Tables:
    USER.TABLE Convertible Truncation Lossy
    Application Data:
    USER.TABLE Convertible Truncation Lossy
    APPLSYS.BISM_OBJECTS 4 0 0
    APPLSYS.DR$FND_LOBS_CTX$I 0 103 1,260,883
    APPLSYS.FND_CONC_PROG_ANNOTATIONS 272 0 0
    APPLSYS.FND_OAM_CONTEXT_FILES 15 0 0
    APPLSYS.FND_OAM_DOC_LINK 1 0 0
    APPS.FND_OAM_CONTEXT_FILES_1 6 0 0
    AZ.AZ_APIS 11 0 0
    AZ.AZ_SELECTION_SET_ENTITIES_B 48 0 0
    ECX.ECX_DTDS 205 0 0
    ECX.ECX_FILES 91 0 0
    IBC.IBC_ATTRIBUTE_BUNDLES 41 0 0
    JTF.JTF_HEADER_DTD 1 0 0
    JTF.JTF_MESSAGE_OBJECTS 82 0 0
    JTF.JTY_TRANS_USG_PGM_SQL 29 0 0
    ODM.ODM_PMML_DTD 1 0 0
    OKC.OKC_REPORT_SQL_B 3 0 0
    OKC.OKC_REPORT_SQL_TL 2 0 0
    OKC.OKC_REPORT_XSL_TL 5 0 0
    XDP.XDP_PROC_BODY 10 0 0
    [Distribution of Convertible, Truncated and Lossy Data by Column]
    Data Dictionary Tables:
    USER.TABLE|COLUMN Convertible Truncation Lossy
    MDSYS.OPENLS_NODES|SYS_NC00004$ 17 0 0
    MDSYS.SDO_COORD_OP_PARAM_VALS|PARAM_VALUE_FILE 200 0 0
    MDSYS.SDO_GEOR_XMLSCHEMA_TABLE|XMLSCHEMA 1 0 0
    MDSYS.SDO_STYLES_TABLE|DEFINITION 78 0 0
    MDSYS.SDO_XML_SCHEMAS|XMLSCHEMA 3 0 0
    ORDDATA.ORDDCM_CT_PRED_OPRD|SYS_NC00004$ 51 0 0
    ORDDATA.ORDDCM_DOCS|SYS_NC00005$ 9 0 0
    ORDDATA.ORDDCM_MAPPING_DOCS|SYS_NC00007$ 1 0 0
    SYS.METASTYLESHEET|STYLESHEET 178 0 0
    SYS.REGISTRY$ERROR|MESSAGE 1 0 0
    SYS.REGISTRY$ERROR|STATEMENT 1 0 0
    SYS.RULE$|CONDITION 21 0 0
    SYS.SCHEDULER$_EVENT_LOG|ADDITIONAL_INFO 182 0 0
    SYS.WRH$_SQLTEXT|SQL_TEXT 2,099 0 0
    SYS.WRH$_SQL_PLAN|OTHER_XML 1,736 0 0
    SYS.WRI$_ADV_ACTIONS|ATTR5 2,726 0 0
    SYS.WRI$_ADV_ACTIONS|ATTR6 2,726 0 0
    SYS.WRI$_ADV_DIRECTIVE_META|DATA 5 0 0
    SYS.WRI$_ADV_OBJECTS|ATTR4 2,278 0 0
    SYS.WRI$_ADV_RATIONALE|ATTR5 9,594 0 0
    SYS.WRI$_ADV_SQLT_PLANS|OTHER_XML 455 0 0
    SYS.WRI$_ADV_SQLT_PLAN_STATS|OTHER 288 0 0
    SYS.WRI$_DBU_FEATURE_METADATA|INST_CHK_LOGIC 21 0 0
    SYS.WRI$_DBU_FEATURE_METADATA|USG_DET_LOGIC 167 0 0
    SYS.WRI$_DBU_FEATURE_USAGE|FEATURE_INFO 16 0 0
    SYS.WRI$_DBU_HWM_METADATA|LOGIC 20 0 0
    SYS.WRI$_REPT_FILES|SYS_NC00005$ 27 0 0
    XDB.XDB$DXPTAB|SYS_NC00006$ 2 0 0
    XML CSX Dictionary Tables:
    USER.TABLE|COLUMN Convertible Truncation Lossy
    Application Data:
    USER.TABLE|COLUMN Convertible Truncation Lossy
    APPLSYS.BISM_OBJECTS|SYS_NC00023$ 4 0 0
    APPLSYS.DR$FND_LOBS_CTX$I|TOKEN_TEXT 0 103 1,260,883
    APPLSYS.FND_CONC_PROG_ANNOTATIONS|PROGRAM_ANNOTAT 272 0 0
    APPLSYS.FND_OAM_CONTEXT_FILES|TEXT 15 0 0
    APPLSYS.FND_OAM_DOC_LINK|DOC_LINK_INFO 1 0 0
    APPS.FND_OAM_CONTEXT_FILES_1|TEXT 6 0 0
    AZ.AZ_APIS|FILTERING_PARAMETERS 11 0 0
    AZ.AZ_SELECTION_SET_ENTITIES_B|FILTERING_PARAMETE 48 0 0
    ECX.ECX_DTDS|PAYLOAD 205 0 0
    ECX.ECX_FILES|PAYLOAD 91 0 0
    IBC.IBC_ATTRIBUTE_BUNDLES|ATTRIBUTE_BUNDLE_DATA 41 0 0
    JTF.JTF_HEADER_DTD|HEADER_DTD 1 0 0
    JTF.JTF_MESSAGE_OBJECTS|BUS_OBJ_DTD 41 0 0
    JTF.JTF_MESSAGE_OBJECTS|BUS_OBJ_SQL 41 0 0
    JTF.JTY_TRANS_USG_PGM_SQL|BATCH_DEA_SQL 1 0 0
    JTF.JTY_TRANS_USG_PGM_SQL|BATCH_INCR_SQL 5 0 0
    JTF.JTY_TRANS_USG_PGM_SQL|BATCH_TOTAL_SQL 6 0 0
    JTF.JTY_TRANS_USG_PGM_SQL|INCR_REASSIGN_SQL 5 0 0
    JTF.JTY_TRANS_USG_PGM_SQL|REAL_TIME_INSERT 6 0 0
    JTF.JTY_TRANS_USG_PGM_SQL|REAL_TIME_SQL 6 0 0
    ODM.ODM_PMML_DTD|DTD 1 0 0
    OKC.OKC_REPORT_SQL_B|SQL_TEXT 3 0 0
    OKC.OKC_REPORT_SQL_TL|HELP_TEXT 2 0 0
    OKC.OKC_REPORT_XSL_TL|HELP_TEXT 2 0 0
    OKC.OKC_REPORT_XSL_TL|XSL_TEXT 3 0 0
    XDP.XDP_PROC_BODY|PROC_BODY 10 0 0
    -------------------------------------------------- ---------------- ---------------- ----------------

    Hi;
    Please run below query which could be helpful for your issue:
    select * from dictionary where TABLE_NAME LIKE '%NLS%'
    select * from dictionary where TABLE_NAME LIKE '%GLOBAL%'
    Regard
    Helios

  • How can i convert a char[] to String?

    Hi all!,
    What would be the easiest way to convert a char[] to a String? Im trying to set the text of a JTextArea which takes a String as an arguement but i have a character arry that if filled from a FileReader. Any suggestions?
    Thanks.

    The easiest way would be new String(charArray). There's a version of the constructor in the String class that take a char array

  • Reg: convertion of char format to RAW.

    hii all,
              I am trying to convert the char data of length 22 to RAW16(output length 32) in the below manner.
      data : ip type char22,
             op type RAW16.
      field-symbols: <ptr_y> type RAW16.
      assign ip to <ptr_y> casting.
      move <ptr_y> to op.
      write : op.
    am i doing the correct way,for converting? bcos i am not getting the output that is requried.
    help me in this regards.
    with regards,
    sandeep akella.

    Hi,
    Uninterpreted byte stringis RAW. Fields of type RAW may have only a maximum length of 255 in tables.
    Declare as String variable and move in to this variable.
    Regards
    Md.MahaboobKhan

  • Convert UTF8 to WE8ISO8859P1 or WE8ISO8859P15

    Hi!
    If got the following situation:
    I've got a database with the character set WE8ISO8859P1.
    I've got a second database with UTF8.
    I think all databases are 10.2.xx
    There is a pl/sql interface on the WE8ISO8859P1 Database which reads data from the UTF8 database via database link.
    But after inserting UTF8-data into the WE8ISO8859P1 database, the are not converted correctly automaticaly.
    How can i convert UTF8-data within my WE8ISO8859P1 database to WE8ISO8859P1-data?
    Is there a standard function within the WE8ISO8859P1 database?
    e.g. Select standard_convert_func(my_col, 'UTF8', 'WE8ISO8859P1') from myTable@db_link
    Or is the better way to convert this utf8-data to WE8ISO8859P1 within the UTF-8 database?
    insert into my_interface_tabele(my_col) select standard_convert_func(my_col, 'UTF8', 'WE8ISO8859P1') from my_utf8_base_tabel;
    Thank you for your help!
    Best regards,
    Thomas

    Hi!
    Within my ISO-DB i receive the following results in SQL*Plus:
    SQL> select convert(DN_DIENSTTITEL, 'WE8ISO8859P1', 'UTF8')
    2 from dn_stammtest@lsal_n_pep_test_link;
    CONVERT(DN_DIENSTTITEL,'WE8ISO8859P1','UTF8')
    A K B A R I A N `ag6 ¿ N a t a l
    SQL> ed
    Datei afiedt.buf wurde geschrieben
    1 select dump(DN_DIENSTTITEL)
    2* from dn_stammtest@lsal_n_pep_test_link
    SQL> r
    1 select dump(DN_DIENSTTITEL)
    2* from dn_stammtest@lsal_n_pep_test_link
    DUMP(DN_DIENSTTITEL)
    Typ=1 Len=40: 0,65,0,75,0,66,0,65,0,82,0,73,0,65,0,78,0,32,1,96,1,97,1,103,4,54,32,172,0,32,0,78,0,9
    I will contact the DB-Admin to do this select within the UTF8 DB.
    Best regards.
    Thomas

  • How can I convert a char to element? urgent !!!

    I have a String put into an charArray. now I want to convert this char to an Element-Type. Whats the right way ???
    thanks a lot for help

    private String htmlTagFilter(String htf)There is absolutely no way to get 'attributes' starting with the above method declaration. String doesn't have that information and nothing you do to it will get it.
    Now maybe the value of the string has text which describes an attribute. But if that is the case then you are going to have to go looking for it. That means parsing the string to find pieces and then extract it.
    getAttributes()-Method from class javax.swing.text. There is no such class. I would guess you are referring to javax.swing.text.Element and its method getAttributes().
    However that method returns an AttributeSet which is an interface. So to create your own AttributeSet you are going to have to know in great detail what exactly goes into that before you can parse a string and create it.
    I will go out on a limb here and suggest that you don't really want to parse that String. You are trying to achieve an objective and got off on this tangent. And if you explain how you got the string and what you want to do with it, maybe some one could explain how to do what you want.

  • Converting UTF8 to US7ASCII

    Hello,
    We have a database which is 9i and has a NLS_CHARACTERSET set to US7ASCII.
    We created a new database (version 10g 10.2.0.2.0) on a new server which has a NLS_CHARACTERSET set to UTF 8. When we exported the database from the 9i database to 10g database, obviously because of the NLS_CHARACTERSET there was an issue of data corruption (Columns width increasing by 3 times, understandable). Is there a way to convert the UTF8 character set on the 10g database to US7ASCII character set, and then re-importing and exporting the 9i database to 10g database. I know we can convert a subset to superset. I want to find out if there is a way to convert a superset to a subset.
    Or do I have to re-create the whole database again.
    Thanks,
    Kalyan

    You shouldn't have problem migrate a US7ASCII to UTF8. UTF8 is superset of US7ASCII.
    The problem you are facing is when your schema has column defined as CHAR(20) for example, a single byte character becomes a two-byte character in UTF8, you now have Data Truncation issue. Same problem can also happens in varchar type.
    You can't change from superset to subset for obvious reason but you can convert your 9i from US7ASCII to UTF8 if you like.
    Also run this character set scanner before you make conversion.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96529/ch11.htm#1005049

  • Convert UTF8 to 8-bit intellegently

    I need to convert a UTF8 file into 8-bit.
    Of coarse, there is no way to do this perfectly, but it would be nice if there was a function that would make an intellegent substitution for characters that aren't in ASCII. For instance, the curly double quotes character would become a normal double quotes.
    I tried using String.getBytes("ISO-8859-1"), but it just subsitutes a question mark for all characters that aren't in ASCII.
    Anyone know of a function that can do this?

    just wrote Very long winded method for most of the common utf-8
    //list of unexcepted frequent chars: �����������������������������������������������������������
    StrAllData = StrAllData.replaceAll("�", "\"");
              StrAllData = StrAllData.replaceAll("�", "\"");
              StrAllData = StrAllData.replaceAll("�", "\'");
              StrAllData = StrAllData.replaceAll("�", "\'");      
              StrAllData = StrAllData.replaceAll("�", "A");                StrAllData = StrAllData.replaceAll("�", "A");
              StrAllData = StrAllData.replaceAll("�", "A");                StrAllData = StrAllData.replaceAll("�", "A");
              StrAllData = StrAllData.replaceAll("�", "E");                StrAllData = StrAllData.replaceAll("�", "E");
              StrAllData = StrAllData.replaceAll("�", "E");                StrAllData = StrAllData.replaceAll("�", "E");
              StrAllData = StrAllData.replaceAll("�", "I");                StrAllData = StrAllData.replaceAll("�", "I");
              StrAllData = StrAllData.replaceAll("�", "I");                StrAllData = StrAllData.replaceAll("�", "I");
              StrAllData = StrAllData.replaceAll("�", "N");                StrAllData = StrAllData.replaceAll("�", "O");
              StrAllData = StrAllData.replaceAll("�", "O");                StrAllData = StrAllData.replaceAll("�", "O");
              StrAllData = StrAllData.replaceAll("�", "A");                StrAllData = StrAllData.replaceAll("�", "E");      
              StrAllData = StrAllData.replaceAll("�", "E");                StrAllData = StrAllData.replaceAll("�", "E");      
              StrAllData = StrAllData.replaceAll("�", "E");               StrAllData = StrAllData.replaceAll("�", "I");      
              StrAllData = StrAllData.replaceAll("�", "I");                StrAllData = StrAllData.replaceAll("�", "B");      
              StrAllData = StrAllData.replaceAll("�", "I");                StrAllData = StrAllData.replaceAll("�", "N");      
              StrAllData = StrAllData.replaceAll("�", "a");                StrAllData = StrAllData.replaceAll("�", "O");      
              StrAllData = StrAllData.replaceAll("�", "a");               StrAllData = StrAllData.replaceAll("�", "a");
              StrAllData = StrAllData.replaceAll("�", "a");               StrAllData = StrAllData.replaceAll("�", "a");
         StrAllData = StrAllData.replaceAll("�", "a");               StrAllData = StrAllData.replaceAll("�", "c");               
         StrAllData = StrAllData.replaceAll("�", "e"); StrAllData = StrAllData.replaceAll("�", "e");
         StrAllData = StrAllData.replaceAll("�", "e");               StrAllData = StrAllData.replaceAll("�", "e");
              StrAllData = StrAllData.replaceAll("�", "e");               StrAllData = StrAllData.replaceAll("�", "i");
              StrAllData = StrAllData.replaceAll("�", "i");               StrAllData = StrAllData.replaceAll("�", "i");
              StrAllData = StrAllData.replaceAll("�", "i");               StrAllData = StrAllData.replaceAll("�", "n");               
              StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "o");
              StrAllData = StrAllData.replaceAll("�", "u");               StrAllData = StrAllData.replaceAll("�", "e");
              StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "u");
              StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "u");
              StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "u");
              StrAllData = StrAllData.replaceAll("�", "y");               StrAllData = StrAllData.replaceAll("�", "Z");               
              StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "y");
              StrAllData = StrAllData.replaceAll("�", "z");               StrAllData = StrAllData.replaceAll("�", "e");
              StrAllData = StrAllData.replaceAll("�", "S");               StrAllData = StrAllData.replaceAll("�", "o");
              StrAllData = StrAllData.replaceAll("�", "s");               StrAllData = StrAllData.replaceAll("�", "Y");

  • Convertion from Char to Hex

    Hi Experts,
    I have a requirement to convert char type to Hex type.
    I have two structures. one is Character type and other is hex type like below.
    data: v_hex(300) type h,
            v_char(300) type c.
    When we move v_char(300) to v_char(300), it is working fine in 4.6 system.
    But it is giving unicode error in ECC 6.0. So i have changed the statement to v_hex = v_char.
    There is no syntax error but it is not converting the same.
    Please post your replies. Thanks in advance.

    REPORT  ZSRK_039                                .
    DATA: V_HEX(300) TYPE X,
          V_CHAR(300) TYPE C.
    V_CHAR = 'Test'.
    PERFORM CHAR_TO_HEX_CONV USING V_CHAR
                             CHANGING V_HEX.
    WRITE : / V_HEX.
    *&      Form  CHAR_TO_HEX_CONV
          text
         -->P_V_CHAR  text
         <--P_V_HEX  text
    FORM CHAR_TO_HEX_CONV  USING    CH TYPE C
                           CHANGING CH1 TYPE X.
      FIELD-SYMBOLS : <FS_TR> TYPE X.
      ASSIGN CH TO <FS_TR> CASTING TYPE X .
      CH1 = <FS_TR>.
    ENDFORM.                    " CHAR_TO_HEX_CONV

  • Check a convertion from CHAR TO NUMC

    Hi,
    I import a flatfile into a structure that contains only CHAR-fields. Then I make a TRY-CATCH construct for every field in P,I,F,N..-datatypes to check if the data is correct.
    P,I,F raise a CONVERT-Exception that i can handle.
    A move to N-field raise no exception but put a wrong values to the N-field.
    Example:
    Charfield contains ' 1  1 0000', N-field is '110000'.
    A compare in the program like
    IF C-Field <> N-Field raise a exception that can't be catched by TRY-Catch.
    How can i check if the field is correct?
    Anybody understand me and have an idea?
    Regards,
    Stefan

    Hi Christian and Rich,
    thank you for your fast reply.
    I've written one TRY method that has a import-parameter with TYPE ANY and a import-parameter for the target field.
    The target field can be everything like P,I,F,N,C,D.
    The method checks if the value can be converted into the target field and avoid a shortdump, when the flatfile contains bad data.
    So I have to get the type by
    cl_abap_typedescr=>describe_by_data
    and then make your suggested Conatins-only-check if it is a
    cl_abap_typedescr=>typekind_num
    Thanks,
    Stefan

  • Convert from CHAR to HEXA

    Hi Experts ,
    i am working  in Upgradation project. In one of the program i  came   across  Moving  Char  value to Hexa value. More over , the char(  CHAR(1)  )   value is passing dynamically to Hex.
    Is there any function module to solve this issue. i got  CHAR_HEX_CONVERSION  but it is not working.
    Thank you.
    Regards,
    Kiran.

    Hello,
    Does the method CONVERT of class CL_ABAP_CONV_IN_CE help ?
    A few links which might interest you :
    [Conversion xstring to string|Conversion xstring to string]
    [http://help.sap.com/saphelp_nw70/helpdata/en/ba/78d3c747b24546ab1c1499a054d8a5/content.htm|http://help.sap.com/saphelp_nw70/helpdata/en/ba/78d3c747b24546ab1c1499a054d8a5/content.htm]
    BR,
    Suhas
    Edited by: Suhas Saha on Jan 21, 2010 5:41 PM

  • Convert from char to int

    hey
    I've an input string ("1234")
    What i need to do is to fill a matrix 2*2 with the input string.
    I thought about running over the string, and by str.charAt(ind) to get a needed charters, but the question is ho do i convert charAt result to int?
    tanx

    igalep132 wrote:
    hey
    I've an input string ("1234")
    What i need to do is to fill a matrix 2*2 with the input string.
    I thought about running over the string, and by str.charAt(ind) to get a needed charters, but the question is ho do i convert charAt result to int?
    tanxThat's kinda vague. Do you mean convert '1' into the integer value 1 or convert '1' into the ASCII integer value of 49?
    Here's how to do the first:
    String one = "8";
    String two = "3";
    String numbers = "0123456789";
    int oneInt = numbers.indexOf(one);
    int twoInt = numbers.indexOf(two);
    System.out.println("oneInt = " + oneInt);
    System.out.println("twoInt = " + twoInt);If you meant the latter then ...
    char c = 'c';
    int cInt = (int)c;

  • Convert from char* to unsigned char*

    Hi, I try compile example from: http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14294/relational.htm#i1000940
    in Visual C++ and I have problem with:
    const string userName = "SCOTT";
    because string is defined as unsigned char* and "SCOTT" is char*, is any function to convert from type char* to type unsigned char* ?

    I'm apologize for this stupid question, answer is very easy:
    const string userName = (const unsigned char*) "SCOTT";

  • Need you help !!! -- Convertion from Char to Date

    Dear experts:
    I am new to abap and here is one thing need your help:
    Currently I have a char type field defined in the source table, after I retrive this field into my work area, I need to convert it to Date type and then calculate the last day of this date.
    for example: WA_TEST-CHAR = '20100801'. This value in orignal ECC table is char type.
    Then How can I convert this value to a date type, and calculate its last day?
    My expected result is "20100731".
    BTW, does anybody know how to convert a date type field to a number type field like To_number() or something?. If I need to get the period between 2 different date, how can I get this?
    Any post will be appreciate and thank you all in advance!
    Best Regards
    Tim
    Moderator message: sorry, date conversion and date calculation are very basic and FAQs, please search for available answers, also read ABAP online documentation.
    locked by: Thomas Zloch on Aug 23, 2010 9:56 AM

    Hi,
    For your question:
    BTW, does anybody know how to convert a date type field to a number type field like To_number() or something?. If I need to get the period between 2 different date, how can I get this?
    use this FM FIMA_DAYS_AND_MONTHS_AND_YEARS.
    regards,

  • Convert to char

    How do I convert String to Char?
    String testString;
    testString = "A";
    Char testChar;
    ???

    Let me take your hand:String testString;
    testString = "A";
    char testChar;
    // here comes the solution
    // are you ready for it?
    testChar = testString.charAt (0);

Maybe you are looking for