What type should I use to store the ISBN number in C? - isbn

I'm creating a code which storing the book data into a struct. So, the data including the book's title, author's name, price and ISBN number (which including the dashes to group the 13-digit code). So for title and name, for sure using string and also float for price. But I'm stuck in ISBN number because it containing dashes. So, what type should I use to store the numbers and dashes?
I'm still a beginner in coding program. :(

Related

HL7v2: Should the empty/blank repeating fields be removed?

Some segments in HL7v2 can be repeating, but what if one of those repetitions is blank? Should the blank repetition be removed? Or should they remain?
For example, in the below extract PID.13 is a repeating field, but the first repetition is blank. It does not even contain "" (empty string).
PID|||A123456789^^^555^PI||Data^Test^^^Mr||19500101|M|||123 Test Road^Testington^^^AA1 2AA||~07778895566|||M|||||||||||||""|||
The PID-13 field has been deprecated as of v2.7 and should no longer be used. Use PID-40 instead.
PID-13 is a special case because the first occurrence has a special meaning, so if there are multiple field repetitions then you shouldn't remove the first one even if it isn't populated. For other fields which don't have documented special cases, you can safely delete empty field occurrence without changing the meaning of the message.
Please refer to this answer.
There are two things needs to be understood.
First:- Empty/blank/null value is also a value. Blank repetitions should not be removed.
Following is what specifications (2.3.2.4 Repetition Separator) say:
2.3.2.4 Repetition Separator.
The repetition separator is used in some data fields to separate multiple occurrences of a field. It is used only where specifically authorized in the descriptions of the relevant data fields. The character that represents the repetition separator is specified for each message as the second character in the Encoding Characters data field of the MSH segment. Absent other considerations it is recommended that all sending applications use '~' as the repetition separator. However, all applications are required to accept whatever character is included in the Message Header and use it to parse the message.
Yes; it does not clearly say anything about removing or keeping empty sub-components. Yes, it neither specifically say that empty value is also a value nor the opposite. I fail to find it in other parts of specifications as well.
To come to the conclusion, we need to move to second thing.
Second:- The sequence of repetition values may also be important. This sequence will change if empty values are removed. This may also change the meaning of the value.
Let us take an example of PID.13 you mentioned in the question.
This field contains the patient's personal phone numbers. All personal phone numbers for the patient are sent in the following sequence. The first sequence is considered the primary number (for backward compatibility). If the primary number is not sent, then a repeat delimiter is sent in the first sequence.
As you can see above, empty value for first sub component tells you that "there is no primary number available for patient". By removing empty value, you are actually putting "secondary number" in place of primary number which may be wrong depending on your use case or implementation.
Other example of PID.3:
This field contains the list of identifiers (one or more) used by the facility to uniquely identify a patient (e.g., medical record number, billing number, birth registry, national unique individual identifier, etc.).
As you can see, by removing empty values in-between changes the meaning of identifier.
I will still prefer clear reference from specifications, but based on what said above, I will avoid removing empty values.

Extracting words from strings when string format differs (Google sheets)

I am trying to extract campaign names from lines of strings. The problem is that campaign name formats are different.
What would be the best way to extract campaign names in bold in this case?
Is it possible to do this combining IF and TRIM functions?
Beginnings repeat in multiple campaigns:
AO:11112_LTV_EDP_
AO:12311_
RTU_EDP_CHIKITA_
AO:15616_FI_
Campaign list:
AO:11112_LTV_EDP_BAMBINO_All_Q1BeesAreGettingThem_mumba_jumba_v23
AO:12311_slimyinfluencer_v24_photoad
RTU_EDP_CHIKITA_PlainSnail_ai_karamba_v2
AO:15616_FI_potatogoestohollywood_hail_the_snail_0
In case of single format, I was using formula:
=TRIM(SPLIT((MID(A2,(SEARCH("EDP",A2)),LEN(A2))),"_"))
Thank you for your help!
If there's a limited number of campaigns you can make a list of all known campaign names and then extract them from longer string.
How to make a list.
If you put in B2:
=regexextract(a2,"Q1BeesAreGettingThem|slimyinfluencer|Snail|potatogoestohollywood") - this will extract the name of campaign found.
If there's for example 50 campaign names and growing, you can make a column with your campaign names (let's say in column D)
Then you join all these names into one expression and put into regexectract:
=regexextract(a2,join("|",D2:D))

Matching MapKit Places with Facebook Places

I am saving photos with city names to server in my application. Firstly, I am getting city names with MapKit, by using latitude and longitude, and then saving photo and city name to database. Later when user want to search a photo, he/she writes the city name and I use autocomplete with Facebook Places (Graph API).
The problem is Facebook Places and MapKit might have different names (spelling). Even they are both in English. I am wondering how to query from my own server which have MapKit cities in it, with Facebook Places cities.
I assume it a is little bit more complicated as it seems first time. Until Facebook, Apple are not using the same data source for their city names it will be hard to find the cities where the name is not exactly the same if you are using the "raw" string, that you get from the FB places.
Maybe there is a much easier way to achieve it, but my first attempts would cover these options:
Save the geo points when you upload the photo, then find a library, API etc.. that returns you a latitude longtitude data based on the Facebook city name and then use this to query the closest result in your database (based on photo location)
2.
Suppose the user typed in a city name and you have a string value (call it rawCity) with the desired city name. Now rawCity should be contained in or be equal to the string that represents the city's Mapkit name.
Let's assign rawCity to a new string called searchStringCity and remove white spaces from it and make the whole string lowercase (non-ascii chars can make some trouble too).
Now you have two strings that should be added to a dictionary: /Pseudo code/
rawCity = Sample City Name
searchStringCity = yoursamplecity
fbCityDictionary = {rawName:rawCity, searchString:searchStringCity}
After you have the fbCityDictionary you're ready with the Facebook part.
As a second step you need some database related work, so next I would create a searchString column in my database and fill it with the "standarized"(remove whitespaces,uppercases,charachter coding stuff) name of the Mapkit type city name.
Now you can write a query where a db item's searchString value is equal to fbCityDictionary[searchString]. However it won't perfectly solve your problem, it will work when a whitespace or a lower/uppercase letter was the problem, but there are a lot of city names that doesn't has an english version and they can be much different in different map databases.
So you will be good for example cases like these:
Facebook version:
Sample City Name ---> samplecityname
Mapkit version:
Samplecity Name ---> samplecityname
These solutions can improve the results, but I would be curious to hear a better solution.

Currency of in-app billing transaction

I see that the response I get from Google Play after the user had purchased one of my in-app products contains the following information:
Description, ItemType, Json, Price, Sku, Title and Type
Price is a string that contains the currency and price. eg: "€1.17".
I would like to get the same price information in a more structured way and separately. Something like a three digit ISO code of the currency and the price in numeric format, without having to parse the string, which would have been ugly and unsafe.
Do you think that there is a way to do this?
Check price_amount_micros field.
Price in micro-units, where 1,000,000 micro-units equal one unit of
the currency. For example, if price is "€7.99", price_amount_micros is
"7990000".
More here: In-app Billing Reference

Where can I find the names of currency sub-divisions such as cents, centimes,

This should be useful for anyone who needs to write out amounts in words in SAP.
I need to convert an amount, e.g. $100.15, into words ("One hundred dollars and fifteen cents"). For the amount, I use function module spell_amount, which gives me "one hundred" and "fifteen". The name of the currency is easily found in table TCURT. Where can I find the name of the currency subdivision?
I think there is no such table. There are already some discussions about it (e.g at SCN: Table for currency) and the conclusion is: Make your own table.
If you want to create the table, you may get the name of sub-divisions in the German Wikipedia-article for ISO 4217 (Untereinheit means sub-division) or List of circulating currencies

Resources