将一串字符串中的信息提取到数组中

时间:2017-09-19 00:20:52

标签: arrays regex string data-extraction ansi-c

假设我有这种字符串信息:

/*
    There are a total of 10 entries in the algebraic variable array.
    There are a total of 4 entries in each of the rate and state variable arrays.
    There are a total of 8 entries in the constant variable array.
*/
    #include "HEADER_NAME"        // change it according to your actual header name

/*
 * TIME is time in component environment (millisecond).
 * NV_Ith_S(STATES,0) is V in component membrane (millivolt).
 * CONSTANTS[0] is E_R in component membrane (millivolt).
 * CONSTANTS[1] is Cm in component membrane (microF_per_cm2).
 * ALGEBRAIC[4] is i_Na in component sodium_channel (microA_per_cm2).
 * ALGEBRAIC[8] is i_K in component potassium_channel (microA_per_cm2).
 * ALGEBRAIC[9] is i_L in component leakage_current (microA_per_cm2).
 * ALGEBRAIC[0] is i_Stim in component membrane (microA_per_cm2).
 * CONSTANTS[2] is g_Na in component sodium_channel (milliS_per_cm2).
 * CONSTANTS[5] is E_Na in component sodium_channel (millivolt).
 * NV_Ith_S(STATES,1) is m in component sodium_channel_m_gate (dimensionless).
 * NV_Ith_S(STATES,2) is h in component sodium_channel_h_gate (dimensionless).
 * ALGEBRAIC[1] is alpha_m in component sodium_channel_m_gate (per_millisecond).
 * ALGEBRAIC[5] is beta_m in component sodium_channel_m_gate (per_millisecond).
 * ALGEBRAIC[2] is alpha_h in component sodium_channel_h_gate (per_millisecond).
 * ALGEBRAIC[6] is beta_h in component sodium_channel_h_gate (per_millisecond).
 * CONSTANTS[3] is g_K in component potassium_channel (milliS_per_cm2).
 * CONSTANTS[6] is E_K in component potassium_channel (millivolt).
 * NV_Ith_S(STATES,3) is n in component potassium_channel_n_gate (dimensionless).
 * ALGEBRAIC[3] is alpha_n in component potassium_channel_n_gate (per_millisecond).
 * ALGEBRAIC[7] is beta_n in component potassium_channel_n_gate (per_millisecond).
 * CONSTANTS[4] is g_L in component leakage_current (milliS_per_cm2).
 * CONSTANTS[7] is E_L in component leakage_current (millivolt).
 * NV_Ith_S(RATES,0) is d/dt V in component membrane (millivolt).
 * NV_Ith_S(RATES,1) is d/dt m in component sodium_channel_m_gate (dimensionless).
 * NV_Ith_S(RATES,2) is d/dt h in component sodium_channel_h_gate (dimensionless).
 * NV_Ith_S(RATES,3) is d/dt n in component potassium_channel_n_gate (dimensionless).
 */

前3个数字是每个数组的大小。

之后的长描述是每个数组的索引和名称标签(假设代数,状态,常数和数字是数组)

如何将此信息存储到地图数组或类似ANSI-C中的数据?我知道我们没有ANSI-C中的Map,但我想知道我们是否可以将这些信息从这个字符串中提取到列表数组中。

已经尝试使用REGEX,但仍然失败。

0 个答案:

没有答案